Silent Cacophony's Recent Forum Activity

  • I like Construct's TokenString system expressions for things like this. They are just string variables with different fields separated by some character or string. In this case, I'd use a TokenString with NewLine separators, where each field is another TokenString with a '|' separator, containing each question and answer pair.

    I made a quick example of such a method, here:

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

    It's not commented, and quickly written, but it should get the idea across. It's fairly dynamic, and can help keep the number of events down. If anything in it sparks your interest, and you have any questions, I'll check back when I have more time.

    Basically, you can just double-click the text object above the layout, and enter each 'question|answer' pair on a new line in the popup editor, then run it to test it out. You can end the question list with a NewLine or 'END'.

    Also, You can also just read 'enter key pressed' instead of using a button if you like.

    It assumes all answers are numbers, and converts the strings to floating-point numbers. This can be a bit tricky, if you work with floats. This example uses the system expression FormatDecimal to round off the numbers, but I'm not sure that it works as I would expect it to. May just have to specify that all answers follow a certain format at the beginning of the quiz...

    The data structures that scidave mentioned can also be used in much the same way, though setting them up may require more steps.

  • That looks really cool! Does look like a bit of a cpu/gpu hog, but that's to be expected for such an impressive display.

    Good luck with the continued development.

  • Nice. I like the picking of a random ground tile to expand from instead of a wall tile, too.

    Also i couldn't get your idea of checking to see if the space is occupied before placing the tile to work exactly as you had it written down for some reason, so its slightly different now:

    I tried it with the check for a wall tile, and destroying it if so, and it worked as I expected. Here's a modified version of the V2 .cap:

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

    Just one event bracketed by red comments added to the MakeRoom function. I tested it in a copy of that, where I counted overlapping tiles at the end, and came up with zero each try, so it should eliminate all overlapping tiles.

  • That's pretty cool. I've played around a bit with some random dungeon generator ideas, and they can get quite complex. I've decided to use Python for such a thing, unless it's pretty simple.

    A couple of notes about this come to mind. I noticed that you had trouble with setting a global variable to the user-input room number, and just set it to a static 99 instead. This can be done by coercing the string value into a numerical value by using the system expression int() or float(). In this case, you'd prefer an integer over a floating point number, so you can do it like so:

    + cmdGenerate: On cmdGenerate clicked

    -> Wall: Destroy

    -> Ground: Destroy

    -> System: Set global variable 'NumRooms' to 0

    -> System: Set global variable 'MaxRooms' to int(txtNumRooms.Text)

    -> Function: Call function "MakeFirstRoom" (and Forget picked objects)

    Also, I noted that a 100-room dungeon ends up creating around 5,200 wall tiles and 15,300 ground tiles, then reduces the number of wall tiles to 400-700 or so after destroying the ones that overlap ground tiles. This leaves a lot of 'stacked' ground tiles that are unnecessary. It also may need two passes to remove all of the extra walls, since it's doing all of that in a single tick, and Construct only updates such changes at the end of the tick.

    I would probably avoid creating all of the extra tiles by using the system condition object overlaps point to test of a tile already exists at the current drawing location. Putting the wall and ground tile objects together into a family (say, 'blue') would simplify things. Then the drawing part could be done something like so (in pseudocode):

    if (wall tile):
        if (family blue does not overlap drawing location):
            draw wall tile
    if (ground tile):
        if (wall tile overlaps drawing location):
            destroy wall tile
        if (family blue does not overlap drawing location):
            draw ground tile[/code:3l5u20o5]
    
    That assumes that the wall tiles will be destroyed instantly, and the next check will not see a 'blue' there afterward. I'm not sure if that's the case, but otherwise one could add another 'draw ground tile' after the 'destroy wall tile', I guess.
    
    Any rooms that are inaccessible at the end could be dealt with by running through all walls with a 'for each wall', and checking for the presence of a ground tile either [i]both[/i] north and south of it, or [i]both[/i] east and west of it, and replacing the wall tile with a ground tile if either is true.
    
    Of course, there are tons of other things that one could do with it, too.  But it starts to become a beast at some point along that road.
  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ah. Well, it should work the same way for a family. With family 'Red':

    -> Red: Set speed to Red[RTS].Speed - 10

    just select the family in place of the sprite.

    There is a completely non-obvious method that you may have to use in place of the above:

    - double-click the sprite again in the object view at the bottom of the window. This brings up all of the expressions for it.

    in order to be able to select the family, though... If the family is not in that list, you can double-click an empty spot in the little window to bring up a new window with all of the objects and families, and select it there.

    Or just type it in if you already know the syntax.

  • I remember trying that 'trigger once while true' condition first, and found it unreliable in my case. I could not find any obvious reason why, though. Maybe the events were too complicated, and I couldn't spot an error, but I ended up using the method that I mentioned above. That was several versions of Construct ago, though.

    If the 'trigger once' works for you, then that that's pretty simple. Just add it to the condition. It does the same thing for you, without the overhead of the extra variables and events.

    I have found that 'trigger once' works as expected most of the time when I use it, which is seldom.

  • Hi. Construct lets you select from many expressions from any text entry field that accepts those, such as the 'Set speed' action.

    In case you don't know about any of these, I'll describe the process below.

    Also, even object selection gadgets can be right-clicked and 'Use expression' can be selected. This would be the action (copied as text from Construct) for doing what you mentioned, if the sprite were named 'Unit':

    -> Unit: Set speed to Unit[RTS].Speed - 10

    You can access that 'Unit[RTS].Speed' using the mouse by doing the following:

    • click 'new action' in the event sheet
    • double-click the sprite with RTS behavior (named 'Unit' in the above case)
    • click the 'RTS' tab at the top
    • double-click 'Set speed'

    Here's where you can access a multitude of 'expressions' that Construct provides. You can either just type them into the text entry, or select them from the usual list, or a combination of those is usually the case. From here:

    • double-click the sprite again in the object view at the bottom of the window. This brings up all of the expressions for it.
    • select the 'RTS' tab as before to get those specific to that behavior
    • double-click 'Get speed'

    Now just type in ' - 10' to the end of it.

    The System object also has many useful expressions to use in such a way.

  • I've run into a similar issue before, and I dealt with it by using a variable to keep track of it's state. Suppose that you wanted to rotate a sprite 90 degrees per press to test it out:

    + Xbox360Controller: (1): Start is down
        + System: Is global variable 'StartPressed' Equal to 0
        -> System: Set global variable 'StartPressed' to 1
        -> Sprite: Rotate 90 degrees counter-clockwise
    + System: Else
    -> System: Set global variable 'StartPressed' to 0[/code:5sf9uw9a]
    
    I suppose that you'd need a global or private variable for each button press or multi-button press that you'd want to know the 'pressed' state of.
    
    Note that the [i]else[/i] condition is paired with the [i]Start is down[/i] condition, and the indented condition is a sub-event of the first condition.
  • There's also a nice short tutorial regarding your first question that may clear up any questions you have about that:

    Tutorial: When to use 'for each'

    .

  • Nice post, tulamide. I've seen this issue pop up a lot as well.

    The power of ELSE is not to be underestimated. It provides an elegant way to make two set of actions mutually exclusive, so that only one set will be executed per test.

    And it seems to work nicely in the newest 'unstable' (possible next release candidate) build.

  • Hi. While tulamide provided a nice write-up of the general problem here, I thought I'd reiterate it about your specific problem as well. The thread that tulamide made is definitely worth a read, though, so check that out as well.

    C: On Left Clicked on mutesprite
    Inverted C: Master is Muted (an XAudio2 function)
    A: Set Master Muted (an XAudio2 function)
    A: mutesprite: Set animation to "Animation 1"
    
    C: On Left Clicked on mutesprite
    C: Master is Muted (an XAudio2 function)
    A: Set Master Unmuted (an XAudio2 function)
    A: mutesprite: Set animation to "Default"[/code:3trxyti0]
    
    Using tulamide's 'snapshot' analogy, the thing to note here is that ALL 'On Left Clicked' conditions will be true for the one tick in which they are polled after the left click takes place. This is by design, so that you can have more than one condition testing for it, though it's usually not necessary.
    
    However, changes that you make are generally instantaneous. So, your first event actually sets up the second to be true as well, effectively canceling each other.
    
    The best way to do that is to check for the left click, then in a sub-event of that, check the 'muted' state, carrying out the appropriate actions if so. It's important that both conditions can't be true in the same tick, so the system->else condition comes in handy for that. Put the second set of actions under an else condition, and there is no way that both sets of actions can be run in the same tick. That's also why it worked if you used different keys for each, as that kept both from being true in the same tick.
    
    [code:3trxyti0]C: On Left Clicked on mutesprite
    ---C: Master is Muted (an XAudio2 function)
    ---A: Set Master Unmuted (an XAudio2 function)
    ---A: mutesprite: Set animation to "Default"
    ---C: Else
    ---A: Set Master Muted (an XAudio2 function)
    ---A: mutesprite: Set animation to "Animation 1"
    
    C = Condition
    A = Action
    --- = Sub-event (one level of indentation)[/code:3trxyti0]
    
    That would look just as tulamide's good and easy 'hello world' example in the other thread, if it's hard to tell the structure from the text example.
    
    [quote:3trxyti0]
    BTW-Why isn't there a condition for seeing if the Master is muted? Also, would it be "a XAudio2" or " an XAudio2"?
    
    
    I didn't see an expression for checking the muted state either. Maybe it was overlooked.
    
    And I've always gone with 'an' with words that start with a vowel sound, and I think of that name as 'ex audio two'.
  • Your HDRes2.cap displays perfectly on my 5:4 ratio 1280x1024 display. Looks nice.

Silent Cacophony's avatar

Silent Cacophony

Member since 11 Mar, 2010

None one is following Silent Cacophony yet!

Trophy Case

  • 14-Year Club

Progress

14/44
How to earn trophies