custom movement for straffing left and right

Get help using Construct 2

Post » Sun Jun 24, 2012 10:25 pm

Hi,

I am building a space game and at the moment the player has the spaceship behaviour movement, but i also want them to be able to have thruster control so they can thrust to the left and to the right.

Can anyone advise how to do this with the custom movement behaviour.

So my final controls ideally will be:

W = Thrust forward
S = Thrust backwards
A = rotate left
D = rotate right
Q = Thrust left
E = Thrust right.

Any help greatly appreciated.
thanks.
B
25
S
7
G
5
Posts: 185
Reputation: 5,056

Post » Tue Jun 26, 2012 6:42 am

If you use the eight move behavior you can turn off the angle movement in the object properties, so that you can control the angle manually with the rotation control you have.
It will still allow you to move left and right without changing the angle of the object =). The rest is just setting the custom controls properly.

Hope this is what you need =)
B
42
S
11
G
5
Posts: 446
Reputation: 6,417

Post » Tue Jun 26, 2012 10:20 am

Why dont you use events?

For example:
YourKeyboard W is down: YourSpaceship move forward x pixels
YourKeyboard a is down: YourSpaceship rotate x degrees counter-clockwise
B
3
Posts: 1
Reputation: 782

Post » Wed Jun 27, 2012 6:33 am

@Sargas: The 8 move behaviour is incompatible with standard rotation in the spaceship plugin behaviour. Even if rotation is turned off; essentially moving left always moves the player left on the screen regardless of what direction they are facing, this means they cannot strafe left in relation to their current angle, they can only move left across the screen.

@D4n13l: I am happy to use events, I figured i would have to for this custom movement, however I cannot workout what events will create a thruster style movement going left and right, based ont he current angle of the ship. The ones you describe are obvious and allow you to move down and turn.. But those abilities I have already done. What I need is to be able to allow the ship to strafe left and right based on their current angle and as indicated in my original post I dont know how to do that.

Can anyone out there please help etermine how to create custom movement to strafe left and right in combination with spaceship style behaviours.
B
25
S
7
G
5
Posts: 185
Reputation: 5,056

Post » Wed Jun 27, 2012 11:56 am

i don't really know what do you need , but if you want the player always facing (one side) for example right side you can do this from 8-direction properties tab "set angle" change it to no and it will fix the problem.

with event
   condition : everytick
   action : set player angle to (0 for example).
B
48
S
15
G
6
Posts: 795
Reputation: 12,035

Post » Wed Jun 27, 2012 12:57 pm

Alternatively:

-Move at angle.

Set the angle to move at to the player's angle +/- 90 degrees (Depending if it is strafe right or left)

Something like this.
B
85
S
31
G
14
Posts: 106
Reputation: 16,440


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 26 guests