Sprite "walking" to object spawned by click?

0 favourites
  • 5 posts
From the Asset Store
Hand-painted tiles, objects, animated objects, and background to build a colorful Mayan civilization environment.
  • 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.(:

  • This may give you some ideas.

    <img src="http://dl.dropbox.com/u/57899112/NearestButterflyPursuitEvents.PNG" border="0">

    The .capx is here:

    NearestButterflyPursuit.capx

    (Edited. Previous version didn't go to the nearest object.)

  • 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.

  • 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. <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.(:

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