How do I spawn a number of sprites, moving arround

Get help using Construct 2

Post » Tue Sep 22, 2015 4:32 pm

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:

http://www.file-upload.net/download-109 ... .capx.html (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.
B
24
S
14
G
9
Posts: 118
Reputation: 6,799

Post » Tue Sep 22, 2015 4:51 pm

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:

Image
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Sep 22, 2015 5:01 pm

LittleStain wrote: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:

Image


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: http://www.file-upload.net/download-109 ... .capx.html
B
24
S
14
G
9
Posts: 118
Reputation: 6,799

Post » Tue Sep 22, 2015 5:15 pm

Create an event:

Spieler on pathfinding path found - spieler move along path

and remove the move along path from event 2
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Sep 22, 2015 5:15 pm

try:
Image
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Tue Sep 22, 2015 6:18 pm

That was simple... thank you guys for your fast support! It works now ;-)
B
24
S
14
G
9
Posts: 118
Reputation: 6,799


Return to How do I....?

Who is online

Users browsing this forum: Cubeeo and 18 guests