Magistross's Recent Forum Activity

  • It has something to do with how picking is handled I think. The "Function" object is a unique instance, so the call get executed only once with the first UID from the filtered list of enemy. If the "Sprite" object could somehow link itself with the "Function" object, the internal for each would probably take care of the multiple calls. Maybe something on the to-do list ?

    Anyhow, an explicit for each works and you implemented it perfectly in tandem with the implicit one.

  • There doesn't seem to be an easy way to achieve that, although it's far from impossible.

    Try a for loop, start index 0 to floor(tilemap.width / "tile width") - 1, with a nested for loop that goes like start index 0 to floor(tilemap.height / "tile height") - 1. Since there is no expression to retrieve the tile width/height, you'll have to use the same constants as the tilemap properties.

    In the inner loop, add a new condition that goes like compare tile at x = loopindex("outerloop"), y = loopindex("innerloop") equals to 9, then add your actions to create an enemy.

    edit : Here's a quick example. I replace all cacti by mad faces.

  • Simply put, I want a random index between 0 and the number of remaining possibilities minus 1, since arrays are 0-indexed.

    With that index, I can then retrieve the corresponding frame in the array.

    When the layout begins, the possibilities array get initialized with values from 1 to 4. If the first random index is 0, the first tile is set to animation frame 1. In the next pass, random indexes can only from 0 to 2 (three remaining possibilities). Index 2 get picked, the next tile is set to animation frame 4. And so on so forth...

  • I went ahead and modified your file with an alternate way to do what you want. Here is the file.

    The method consists in populating a "possibilities" array, then building your grid with one random element from the array, removing it from the array everytime, so it doesn't get picked again.

  • Another way :

    for i = 0 to Array.Width * Array.Height - 1

    --Set Array.At(i % Array.Width, int(i/Array.Width)) = i

  • Debugging particular events is not yet implemented if I'm not mistaken, but is indeed in the (evergrowing) todo list !

  • fassFlash There is already a LayoutName expression under the system object, I don't know what you need more !

    On start of layout     -> Do common things

    --subevents

    -LayoutName = "xxxx" -> Do this

    -LayoutName = "yyyy" -> Do that

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I once written an expression to do exactly that. Overkill nested choose FTW !

    choose(NPC.lastdirectionpicked = 0 ? choose(90, 180, 270) : 0, NPC.lastdirectionpicked = 90 ? choose(0, 180, 270) : 90, NPC.lastdirectionpicked = 180 ? choose(0, 90, 270) : 180, NPC.lastdirectionpicked = 270 ? choose(0, 90, 180) : 270)

    Basically, if choose() select the last direction of NPC, it choose again among the remaining three. If no direction was selected (i.e. NPC.lastdirectionpicked = -1 or something), it still picks one of the four possible choices.

  • You can't create patterns with choose() or random() though.

  • Try this expression :

    Play sound : "gun" & (counter < 3 ? "1" : "2") & ".ogg"

    Then set the counter with this expression :

    Set counter to counter % 3 + 1

    (The pattern would be "gun1.ogg" - "gun1.ogg" - "gun2.ogg")

  • If your JSON string is correctly written (and it seems so), you can load it into an array using the JSON - Load action. Just provide the AJAX response as your string. Once it is loaded, you'll only have to index your array accordingly. (i.e. (0,0) for first question, (0,1) for first answer, etc.)

  • Object referencing is usually done via UID. But you need families to be able to reference through multiple kind of object at once, thus the need to upgrade to the paid version.

    There IS a way without it though, but you'd have to do one of the two possible alternatives :

    -All "monsters" are the same sprite object (with multiple animations)

    -Duplicate all events for each kind of monster

Magistross's avatar

Magistross

Member since 4 Jul, 2011

Twitter
Magistross has 14 followers

Trophy Case

  • 13-Year Club
  • Entrepreneur Sold something in the asset store
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Regular Visitor Visited Construct.net 7 days in a row
  • RTFM Read the fabulous manual
  • Email Verified

Progress

20/44
How to earn trophies