How do I move a sprite to a specific location?

Get help using Construct 2

Post » Fri Jan 30, 2015 10:32 pm

I'm trying to make a simple AI for a sprite. I just want to have it move a particular distance in a straight line. (Which could also be specified as moving to a particular location.)

I've tried an 8 Direction behavior and the "simulate control" action, but it seems much too limited. For example, I'd need to be able to tell it when to start moving and when to stop moving. But the "simulate control" only seems to work when associated with a continuous input, such as a "is touching object" condition. I can't find any way to tell it to simply start moving and then keep moving until it reaches a particular destination.

I've also tried using a Pathfinding behavior, but it seems to have the opposite problem. It's far more complicated than I need. The requirement to start a path calculation in one place and then pick up the completion event in another is a bit convoluted. All I need it to do is move in a straight line.

I've also tried using the Bullet behavior, and I can get it to start moving just fine. But I can't figure out how to get it to stop. More specifically, I can't figure out how to monitor its position to tell it when to stop. A "while" loop executes immediately and goes infinite because it never gives the sprite a chance to move.

I'm guessing there must be a simple way to do such a simple thing, but I've been at it for hours and I just can't sort it out. Any help would be greatly appreciated.

Posts: 55
Reputation: 616

Post » Fri Jan 30, 2015 10:34 pm

Posts: 1,077
Reputation: 35,986

Return to How do I....?

Who is online

Users browsing this forum: dop2000, namaewayukidesu, Yahoo [Bot] and 4 guests