Silent Cacophony's Forum Posts

  • There are also some things that you can use in expressions for each object/behavior that might not be obvious. The RTS behavior has X and Y destinations that you can read, for example. You can find these by selecting objects while in an expression entry.

    As an example, you could pick any blue family member that is within 25 pixels of the carrier's intended destination and make it flash, like so:

    + Blue: Pick by distance(Carrier[RTS].DestX, Carrier[RTS].DestY, Blue.X, Blue.Y) < 25

    -> Blue: Flash for 2 seconds with 0.25 seconds interval

    It uses the 'Pick by expression' condition. Also, you can have each family member have a unique value in a 'type' private variable that will let you further identify or pick them. And there is a 'Pick nearest' condition for objects or families that you can use.

  • That's quite cool. I tried it as far out as a 5-tile radius (range 160), and it performed nicely, with relatively few artifacts.

    I like the use of the image manipulator, too.

  • Hi. There are several ways to do that. I made an example of a simple one, here:

    http://dl.dropbox.com/u/5868916/cooldown.cap

    The text object is just there for a visual cue as to what is going on. For example, try removing the Trigger Once and see what it does. I use this method quite often to ensure that I know what is being executed, when.

  • Odd. I wonder if it's got to do with some graphic set to be WAY too large, or just some weird bug...

    It crashes on attempting to load after the same message for me. I've got 1 Gigabyte of video ram.

  • Hi. I don't know if you know of RogueBasin, but there is a link to some articles on line of sight and field of vision. There are tons of other articles, links, and other great content there, too. You can find good info on procedural generation of content there as well.

    I think the problem that you had with the inventory may have been due to Else statements. They work a bit better with the newer versions of Construct, but it's best to keep them as simple as possible if you use them. I've not been able to get them to work reliably in nested code.

    For picking closest enemies, there is a condition for that. Look for the Pick group under conditions. There are a few picking options there. You can do something like:

    + Enemies: Pick closest to: Player.X, Player.Y -> (do action to enemy here)

    A couple of other tips:

    I also noticed that you have a lot of unnecessary Always (every tick) conditions in there. Those are useful if that's the only thing there for a condition. If you already have another condition there, you don't need to add the Always, as it will always check the condition anyway, unless it's in a sub-event of another condition...

    With your clothing system, if you plan to add to it, you may want to look into making one sprite for each type of item, and put the variations of it into different animation frames of the sprite. Then you can just set the one sprite for each type of item to the proper frame. You could also possibly use the Container functionality to keep them on the sprite, or only update them when the character moves.

  • Hi.

    The built-in Date object will return the system time and date, in pieces. The expressions for the time, if you don't rename the object to something other than 'Date', are Date.GetHour, Date.GetMinutes, and Date.GetSeconds. It also can return the date as a string.

    If you are willing to use python, you can import the time module and use the time.time() function to get system time. That module also has a number of other functions for working with times.

  • Very cool. It's always great to hear that an indie/freelance developer made their way into the Big Game biz.

    Congratulations, Thomas!

  • Pretty neat. My best legit is 30 correct, 0 wrong. Using the bug mentioned above, I got 68 correct, 2 wrong on the second try.

  • Hi. I see a few problems there. First, I'll go into those. If I understand what you are trying to do correctly...

    • It appears that event 1 and 2 cancel each other. Construct will go right to event 2 after 1, and reactivate the controller because the stick will still be to the right. If you're trying to stop C1, just set the boundaries so that they have the 'Solid' attribute.
    • In event 3, it seems as though you want to set a state, so that you know what the player selected. But, by Adding 10 to the global variable while c1 is collided with LeftBoundary, your global reaches 20 in two frames, because it's still colliding on the next tick. It's better to Set the global variable to a certain value in this case.
    • In event 4, you are checking that button A is down, so it will be true every tick that the button is down. Since you are Adding to the global variable, once again, it will reach 20 in two ticks again. In this case, it would be better to check the state of the global variable in sub-events to the Button A is down check, and take your actions there.
    • Thus, event 5 should not be needed.

    Here is text version of the way I'd do the events:

    + C1: On collision between C1 and LeftBoundary
    -> System: Set global variable 'MenuSelect' to 1
    + C1: On collision between C1 and RightBoundary
    -> System: Set global variable 'MenuSelect' to 2
    + MouseKeyboard: On key Left mouse button pressed
        + System: Is global variable 'MenuSelect' Equal to 1
        -> System: Go to layout "1234" with transition "None" lasting 0 MS
        + System: Is global variable 'MenuSelect' Equal to 2
        -> System: Go to layout "Whatever" with transition "None" lasting 0 MS[/code:27a6rdlv]
    
    Note that the indented portion is two sub-events, and I used the Left Mouse Button instead of button A. This simply sets the global variable to either 1 or 2, depending upon which boundary is hit last (you can change your mind and hit the other,) and when the button is hit, it checks to see if one was selected, and goes to another layout based upon that choice.
    
    The quick example is here:
    
    [url]http://dl.dropbox.com/u/5868916/ExampleMenu.cap[/url]
    
    If I'm way off about what you wanted, you may need to explain in more detail, and post your .cap. Good luck.
  • I get 20-21 fps, running on mostly 5 or so year-old hardware. The video card is newer, but not high-performance.

    AMD Athlon 64 3000+ 1.8 GHz (single core)

    2Gb DDR 400 RAM

    NVidia GeForce 9500 GT (1Gb)

  • Wine or a virtual machine would be the only way that I know of.

    http://wiki.winehq.org/MacOSX

    http://www.macwindows.com/emulator.html

    I've heard that 'Q' is supposed to be a nice implementation of QEMU for Mac. It's in the second link. I don't have a Mac, but I've considered trying to get Construct to run on linux. I don't use linux much anymore, so I never got around to it.

  • It looks to me like the 'arrived at waypoint' is triggering as the plugin calculates the path ahead of the object's movement position. But, further tests show that it does trigger twice near the correct spots, by spawning another sprite instead of destroying the markers. Anyway, if I quickly place a long series of waypoints ahead of the sprite, they disappear long before it's movement finishes, but it does complete the path correctly.

    I'd say that this is probably unintended behavior, and thus a bug. You may be able to work around it with a proximity check (the object is not guaranteed to overlap them,) and a queue of waypoints (to ensure that they are destroyed in order when paths overlap.) This would not be easy.

    Perhaps an acceptable alternative can be implemented, such as simply having each waypoint fade away after a certain amount of time, or leaving them all until the final destination is reached, then destroying all of them.

    EDIT - Removed flawed workaround, to prevent confusion. R0J0hound posted a good one below. Nice one, R0J0hound!

  • Yeah, Python has many ways that one can implement an array, or something similar.

    In the example above, I built a single-dimensional list to match the single-dimensional array in Construct. The list could have been used instead of the array just as well, but Construct's array object has it's own uses, too.

    Python lists can also simulate multi-dimensional arrays by using lists of lists, like so:

    l = [[1,2,3], [4,5,6], [7,8,9]][/code:3cf635dg]
    
    ... where l[1][1] would reference the value 5. Initializing a multi-dimensional list can seem a bit odd compared to doing the same with an array, because they work a bit differently. Here's an example that builds a 2-d list of 1s, x by y. This uses a handy list comprehension, which is basically shorthand for a normal loop, and operator overloading with the '[1] * x' to build the inner lists of x number of 1s.
    
    [code:3cf635dg]l = [[1] * x for j in range(y)][/code:3cf635dg]
    
    If x = 4 and y = 6, the above results in l containing:
    
    [[1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]]
    
    There are also the 'array' module and 'NumPy' extension that can be imported for real arrays, and dictionaries with tuples for keys can even be used as a sort of array.
  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • namre, it sounds like you may be using a version of Construct before 0.99.84, which is the earliest version that Python works in. You may need to install the latest (unstable) version from here: http://www.scirra.com/forum/viewtopic.php?f=2&t=6488.

    Anyway, I think that sharing Python classes, functions and code snippets is a great idea. Although, the Python integration in Construct is not yet fully implemented, and could use some more general polish, some things can still be done quite nicely with Python.

    For instance, on the topic of sorting, Python has a very nice built-in sort using the Timsort algorithm. But, probably one of the most likely things that someone might want to sort is the Array object, and it doesn't seem to be readable from Python. It's not too difficult the make a Construct function that takes care of the bits that don't yet work in Python, and also add the script in there, but it's not so convenient as just a function or class definition in Python. It can, however, be called from Construct or Python, once made.

    For example, I made a .cap that will sort an Array of 3,000 random numbers between 0 and 30,000. If I could read the Array from Python, a simple Python function could be made that could accept a reference to the Array object to be sorted. Instead, I had to use a Construct function hard-coded for a specific Array object. Not yet an ideal situation.

    I may as well include the .cap here, though.

    http://dl.dropbox.com/u/5868916/SortExample.cap

    The function copies the Array to a python list, sorts the list, and copies the list back to the Array. Seems fairly quick despite the overhead, averaging about 0.034 seconds per 1,000 entries on my machine.

  • Hi, I was interested in this problem, so I took a look at it.

    That's a nice way to set up a variable number of choices in a selection menu, lucid.

    Anyway, I made a couple of changes to make it work, lildragn. The main change is just what happens when you hit enter:

    + MouseKeyboard: On key Enter pressed
    + Blue: Pick by Blue.Value('ID') Equal to global('screenSelect')
    -> System: Go to layout Blue.Value('choiceName') with transition "None" lasting 0 MS[/code:2pk30t3i]
    
    This is one way to do it. Note that here it's telling Construct to go to the layout with the same name as the contents of the string in the variable 'choiceName'. As lucid mentioned, if your target layouts were named as "Layout 1", etc., you could very well use [i]"Layout " & Blue.Value('ID')[/i] instead of [i]Blue.Value('choiceName')[/i], or some other scheme entirely. The picking of the menu item was the main thing to accomplish there, so you can get the ID or choiceName for it.
    
    The other changes that I made were just things that I would have done differently, to the same result, though. Here is the modified .cap:
    
    [url]http://dl.dropbox.com/u/5868916/prototype_brawler3%282%29.cap[/url]
    
    Good luck.