How do I make my character move correspondingly when I...

Get help using Construct 2

Post » Sat May 30, 2015 5:52 pm

...hold down two keys at once to move?

So atm, my character moves with WASD, the usual. But when I, say, press W and A, to make my character go NW, it goes in the complete opposite direction.

Is there a way to program my character to move properly with WASD, and when two keys are held down it moves in the correct in-between direction?
B
5
S
1
Posts: 73
Reputation: 521

Post » Sat May 30, 2015 6:05 pm

Could u put a screensplash of your "code"?
Play my games on www.pocketgames.es
B
13
S
3
Posts: 45
Reputation: 819

Post » Sat May 30, 2015 10:03 pm

Is your character using the 8Direction behavior, @gomotion100?
Life is good. Have another piece of chocolate.
B
15
S
3
G
1
Posts: 28
Reputation: 1,133

Post » Sat May 30, 2015 10:21 pm

Here:

  1. Insert a "Keyboard" object.
  2. Make an event: Keyboard -> Key Is Down -> "W"
  3. Make an action: Player (or whatever you are calling it) -> 8Direction -> Simulate 8Direction pressing Up
  4. Make an event: Keyboard -> Key Is Down -> "A"
  5. Make an action: Player -> 8Direction -> Simulate 8Direction pressing Left
  6. Make an event: Keyboard -> Key is Down -> "S"
  7. Make an action: Player -> 8Direction -> Simulate 8Direction pressing Down
  8. Make an event: Keyboard -> Key is Down -> "D"
  9. Make an action: Player -> 8Direction -> Simulate 8Direction pressing Right

Also, check in your properties panel and make sure the "Directions" property is set to 8 Directions.

Does that help?

theman3446~
Life is good. Have another piece of chocolate.
B
15
S
3
G
1
Posts: 28
Reputation: 1,133

Post » Sun May 31, 2015 9:30 am

I usually do it this way:

viewtopic.php?f=147&t=145626
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


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 11 guests