How do I make 4-way top down movement

Get help using Construct 2

Post » Thu Sep 18, 2014 2:34 pm

I would like some help on creating 4-way top down movement, where if you press any of the 4 directions the object moves in that direction until it hits a wall. For some reason i can't figure this out. Thank you in advance
B
9
S
2
Posts: 18
Reputation: 569

Post » Thu Sep 18, 2014 2:59 pm

use the 8-direction behaviour and set it to 4 directions..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Sep 18, 2014 3:06 pm

LittleStain wrote:use the 8-direction behaviour and set it to 4 directions..


Yes thats the Way to go
B
18
S
6
G
3
Posts: 197
Reputation: 4,129

Post » Thu Sep 18, 2014 4:12 pm

Yea but that still dosnet fix the issues where i want the object to keep moving in a direction until it hits a wall, without holding down the key. I would like to make it so that if i press Right arrow, object is gona move to the right until it hits a wall.
B
9
S
2
Posts: 18
Reputation: 569

Post » Thu Sep 18, 2014 4:30 pm

There are many ways to achieve this..

one would be giving the object an intance variable and set it to the moving direction

on key right arrow pressed - object set instance variable to "right"

object compare instance variable = "right" - object : 8 directions simulate pressing right..

If you do this for all directions, you are ready to go..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Sep 18, 2014 5:21 pm

I already tryed that and the problem i get is when colliding with the wall (solid object). If i do on collison with another object (wall) > Set "Variable" to None. The collision is not precise and i get a 1 to 20px gap bettween the object and the wall. Any idea on how to fix that. I can post the Capx file if that helps?
B
9
S
2
Posts: 18
Reputation: 569

Post » Thu Sep 18, 2014 11:59 pm

I had a situation similar to this in a little experiment I was doing when I started using Construct (keep in mind though I have only been using construct a very short time) that was similar to this.

You could try getting the coordinates of the moving object when it collides with the wall, then set its X and Y to that coordinate at the end of the event.
B
4
Posts: 8
Reputation: 216


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests