Sprite "walking" to object spawned by click?

Get help using Construct 2

Post » Fri Jan 27, 2012 7:08 pm

I've got my new game set up to where an object will spawn every time you click, and one of two sprites will basically teleport to it depending on which side the newest object is spawned on. I'd rather they walk there (instead of teleport instantly), but I have no idea how I'd accomplish this. Also, would it be possible to rotate the sprite to face the object as it moves towards it? Thanks, appreciate it.(:
B
2
Posts: 4
Reputation: 283

Post » Sat Jan 28, 2012 5:05 pm

This may give you some ideas.



The .capx is here:

NearestButterflyPursuit.capx

(Edited. Previous version didn't go to the nearest object.)kittiewan2012-01-28 17:28:44
B
29
S
11
G
12
Posts: 281
Reputation: 11,878

Post » Sat Jan 28, 2012 6:20 pm

I am doing something similar. I applied Bullet behavior to the moving sprite, then when I click I spawn a mover marker and have an event telling the sprite to set speed to 50, and set angle(Sprite.x, Sprite.y, MoveMarker.x, movmarker.y). Then upon arriving at movmarker, destroy marker and set speed 0.Zetar2012-01-28 18:21:34
B
192
S
6
G
7
Posts: 213
Reputation: 10,178

Post » Sat Jan 28, 2012 8:12 pm

I didn't even think of using a bullet behavior, which elimnates the need for the instance variables (although you do have to make sure bullet speed is initially set to zero.)

I also didn't know you could use both a platform and a bullet behavior on the same sprite!

Makes me wonder "What else don't I know?"

Don't answer that.
B
29
S
11
G
12
Posts: 281
Reputation: 11,878

Post » Sun Jan 29, 2012 2:01 am

The bullet behavior worked extremely well, did exactly what I wanted it to do. Really appreciate the help.(: Kittiewan, I didn't try your idea. I checked the thread after you verified his worked. Thanks to both of you.(:
B
2
Posts: 4
Reputation: 283


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests