Delay actor movement & move with cursor

Have any questions or problems in making your game, subscribing and/or using our software? Post here.
Forum rules
Make sure you are using the newest version. This can be downloaded at the top of the site via the "downloads" link.

Use a very good subject. "Problem" or "Help" are unacceptable titles.

Use the search feature before posting a question, as the answer is probably already here.

Subscript out of range error 9: This is a generic error, and we'll need way more information than that to figure out the problem. If you get this, strongly consider following the instructions of submitting your project through the Submit Bug feature within the editor.
User avatar
Danny
001 Forum Master
 
Joined: Tue Jul 12, 2011 7:14 am

Delay actor movement & move with cursor

Postby Danny » Thu Feb 11, 2016 1:49 pm

Okay so need some help with movement of the main actor.

TOPDOWN TEMPLATE

I need the main actor to move only left or right based on the cursors location. I also need it so theres a slight delay in movement for both moving and stopping. I'm making a spaceship in space and when you move the mouse to the left or right i want it to sorta "Glide" in the direction and not just move instantly.

How would i set this up? Thanks :D

User avatar
SBG
001 Subscriber
 
Joined: Thu Jun 17, 2010 8:37 pm
Location: merca

Re: Delay actor movement & move with cursor

Postby SBG » Thu Feb 11, 2016 5:37 pm

For topdown, just worry about the X value, subtract for left and add for right, or just have it match the cursors X, and keep your Y as the actors Y. I'm guessing you want to put this in a timer too.

For the movement you are looking for, simply apply acceleration to your actor, and use a lower value.

If you are using the Walk To event in a timer, it's pretty likely that acceleration won't always work like you want it to, since the actor would always be moving. What you want to do in that case is use a comparison branch at the start of your script, and if the cursors X position is X amount of pixels from the actors X position, do no Walk To. Pretty simple.
Last edited by SBG on Thu Feb 11, 2016 5:40 pm, edited 1 time in total.

User avatar
Danny
001 Forum Master
 
Joined: Tue Jul 12, 2011 7:14 am

Re: Delay actor movement & move with cursor

Postby Danny » Sun Feb 14, 2016 3:31 pm

SBG wrote:For topdown, just worry about the X value, subtract for left and add for right, or just have it match the cursors X, and keep your Y as the actors Y. I'm guessing you want to put this in a timer too.

For the movement you are looking for, simply apply acceleration to your actor, and use a lower value.


Sorry I don't follow? I tried to check if cursors x is less than actor x if so move left, I x is greater than actor x move right, I'm getting nothing but strange movement.


Edit: BUMP!
Last edited by Danny on Sun Feb 14, 2016 3:31 pm, edited 1 time in total.
Reason: Automatically merged double post.


Last bumped by Danny on Sun Feb 14, 2016 3:31 pm.


Return to Technical Support Questions

Who is online

Users browsing this forum: No registered users

cron