0 Favourites

How do I spawn a number of sprites, moving arround

  • Hi there!

    At first, the topic isnt really what I need:

    I got a variable, lets call it "Current_Cats" (int, set to 5).

    The variable represents the amout of cats, whose are spawned on loading the layout/switching to a scene, whatever.

    I already did: spawning the amout of "Cats" on the layout; with pathfinding they also are moving randomly after the last path is completed.

    What is not working: outside of the layout is the reference of 1 "cat sprite", which is duplicated. That little *** isnt moving >.< it just stands there, not doing anything (... anything... it only has to move arround like the other ones).

    As a bonus: when the "Current_Cat" variable reaches 0, there should not be a single one.

    Bonus #2: if someone is bored, I would be thankful for a more optimized version ;-D (but you really dont have to, fixing the "frozen sprite" is more than enough!)

    The capx with beautiful graphics *spoiler* is provided here for you:

    (sorry for providing a freehoster... my ftp is down)

    P.S.: sorry for the german-ish code; "Existent_Spieler"="Existing_Players"; "Spieleranzahl"="Current_Players";"make_spieler"="create_player". Also: the toggled code is experimental, Ill take a look on it later, you dont have to note it.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Why not just use the on start of layout destroy spieler, before you call the action to create them?

    by the way, you are calling a function, but there is no function, so you could just remove that alltogether..

    This should work:

  • Why not just use the on start of layout destroy spieler, before you call the action to create them?

    by the way, you are calling a function, but there is no function, so you could just remove that alltogether..

    This should work:

    Thanks for your fast answer!

    Well, the function is a leftover of the mess I did when wanting to fix the frozen sprite.

    I changed the source to your suggestion, but its still not moving...

    "Optimized" version:

  • Create an event:

    Spieler on pathfinding path found - spieler move along path

    and remove the move along path from event 2

  • try:

  • That was simple... thank you guys for your fast support! It works now

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