(need help)How do I spawn 4 sprites in 1 of 3 areas and after 1 second, they move to a new one?

1 favourites
  • 8 posts
From the Asset Store
This is a Dungeon Master tool & the 1st of 12 Combat Engines from the Building Combat Engines for Browser Games workshop
  • Basically I have 4 copy and pasted sprites, and I want it so that after 1 second of them moving, the system picks a number of 1-3 and they move to an area depending on the number, for example, if 1 is picked, I want it to go to the bottom of the box is the bottom while 3 is the top. I am fine with either they all spawn in the same line or they all spawn in different areas. I added an instance variable and I made it so that if the value is one, it goes to the bottom and vice versa, but the problem is I don't know how to make the system pick those values and it seems that the system is reading the variable since if I click on it, it says that the value "varies", so it knows that the variable changes, but it is just not changing it

  • The current logic you have picks one random instance every second, but you want to move them all I guess. Logic should be every 1 second, for each shrimp, set variable to choose(1,2,3). This assigns it a random location. Then your logic for setting the location should be taken out of the loop and be a separate event that runs constantly, sets location based on their variable.

  • Do you think you can show me an example?

  • I tried, but I think I did it wrong

  • The set Y position events are still inside a loop and sub event. It makes more sense to have them as their own events so you can set the shrimp position based on its value, because it is only the value that changes every 1 second.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is what I got so far and the problem is I don't know how to tell the system to randomly pick 1 - 3 because it just thinks it is -2

    It is this highlighted one that is giving me trouble because when I go to debug and I look at the values, it is changing but it is just does -1 and stuff like -1.9485457

  • Nevermind I fixed it, and thank you for helping me get on track!

  • Nice :)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)