rpg movement question

Get help using Construct 2

Post » Sat Jun 20, 2015 2:46 pm

I get how to do the directional and turn sprite and animation.

what i want to make the player only move in one direction such as left, up, right, down.

And if the player press two or more button the same time do not move. The codes works for the up+down=stop moving that works. the Left+right=stop moving works.

What is strange is that Up+right = stop moving does not work because even though the sprite animation stop moving yet the sprite is slowly being dragged upward.

And the same happens when i press down Left How can i fix that I tried setting the speed to 0 yet it still drag itself upward or downward.

Could this be a bug or is there something else going on that i cannot see
B
52
S
24
G
6
Posts: 391
Reputation: 7,855

Post » Sat Jun 20, 2015 8:48 pm

I don't quite understand what is going on in your project, neither what you are trying to do LOL

Can you upload your .capx, so we can take a better look at it?

Sorry for not being that much help :(
B
17
S
7
Posts: 280
Reputation: 2,522

Post » Sun Jun 21, 2015 7:14 am

By slightly adjusting my easy keyboard example, you could get exactly what you'd like:

viewtopic.php?f=147&t=145626&p=935915&hilit=keyboard+example#p935915
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 » Sun Jun 21, 2015 2:55 pm

yeah i can see how your example @littlestain would help in some ways i like that shift + example but i am rather confuse on how to input the variable for the movement ? i suppose i can just use the variable number and then convert it into a word's variable and do code base on what the word says. even then that is alot of event to track. I would hate for a bug to crawl from that lol

so after fiddling around with the 8 directional action event that we are given, I just found it easier to put start ignoring input and stop ignoring is for the best to use.

But still if you were to code the 4 way directional and then put in the stop moving when up and right are pressed the same time. You would see a dragging going upward id like to know why that is the case ? Im pretty sure you can code that in pretty quick if not i can do it
B
52
S
24
G
6
Posts: 391
Reputation: 7,855

Post » Mon Jun 22, 2015 3:13 am

This tutorial should cover what you are trying to do:
https://www.scirra.com/tutorials/791/4- ... -animation
Check out my VGM on my soundcloud page!
Video-Game Music: E.C.2151
B
9
S
3
G
2
Posts: 194
Reputation: 1,713

Post » Mon Jun 22, 2015 10:26 am

if key up is pressed
ELSE
if key down is pressed
ELSE
if key left is pressed
ELSE
if key right is pressed


This will only allow for 1 key to be pressed at a time.

If you want to allow only up or down and only left or right


if key up is pressed
ELSE
if key down is pressed


if key left is pressed
ELSE
if key right is pressed
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,592


Return to How do I....?

Who is online

Users browsing this forum: BiffanyPFH, Julot135, MadSpy, Yahoo [Bot] and 23 guests