move forward,backwards,up or down from current spot and stop

Get help using Construct 2

Post » Wed Nov 23, 2016 9:16 pm

I have always had trouble with this and was hoping someone can help me once and for all.

I do a lot of weird projects that require a sprite to move forward and stop a specific amount of space. For some reason, it either keeps moving or does something crazy I didn't intend.

Example:
When clicked, move right 35 pixels and stop.
I tried something like set y position Self.Y +35..
This doesn't work..

Any thoughts?
Thank you!
B
12
S
4
G
2
Posts: 132
Reputation: 1,749

Post » Wed Nov 23, 2016 11:27 pm

TheSynan wrote:Example:
When clicked, move right 35 pixels and stop.
I tried something like set y position Self.Y +35..
This doesn't work..


Concerning that example, you would have to set X to Self.X +35 to move right.
set y to Self.Y +35 would move the sprite down.

I don't see why this wouldn't work.
Maybe you could attach a link to your .capx to your next post?

Btw, if you want the sprite to move over time, you can use a variable and lerp.
If you want to use this and need help, gimme a shout.
"We can't solve problems by using the same kind of thinking we used when we created them."
- Albert Einstein
B
27
S
11
G
8
Posts: 528
Reputation: 7,091

Post » Wed Nov 23, 2016 11:28 pm

Yeah, you mean like a grid movement system. There's this old pacman tutorial, on page two it explains how to do that. It's a tricky thing, with sines and cosines and stuff, but the guy explains quite clearly. Mind it's an old tuto tho, may be outdated.
B
23
S
11
G
6
Posts: 181
Reputation: 5,003


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, ignaciosimo and 49 guests