How do I make a two thruster space-craft?

Get help using Construct 2

Post » Sat May 31, 2014 6:04 am

Hey everyone!

I'm currently trying to make a space battle game where the player's ship is controlled by two separate thrusters. Basically, the player rotates the thrusters at will, and can choose which thruster (or both) to use in order to manipulate the ships movement. MY current problem however, is that I have no idea how to do this. So far, I have each thrust pinned to 'wing' of the hull, and they can rotate, which works fine. The problem is, when I try to move the hull using either of the thrusters, it moves rigidly, as if it is a static object being dragged.

Ideally, I would like it so that if (for example), the left thruster was engaged, and the right was not, the ship would slowly rotate to the right, as normal 'physics' would dictate. Does anyone have any idea of how I could go about this?

P.S I have tried the 'Pin' behaviour with a number of settings, from rope, to bar, etc etc.

Thanks for any help anyone can give!
B
4
Posts: 14
Reputation: 243

Post » Sat May 31, 2014 3:50 pm

Pandemonium, are you using the Physics behavior for the thrusters? or some other behavior...you didnt state how the thrusters affect the motion other than by appearing to be dragged
some more info would be good.

some details like ..are the thrusters triggered by key presses or mouse or touch etc?

i would say some of the problems would be related to how your force or impulse(if you are using Physics) is applied and at what angle the force or impulse is applied.

To restrict the engagement of the thrusters, just make an event that goes something like

condition--->key press or whatever-->
actions----->Left thruster-> is active
----->left thruster ->apply force at angle
----->Right thruster-> Physics set disabled

but yeah more info is required to
give better help at this stage ..otherwise at best we are guessing..
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
35
S
13
G
8
Posts: 318
Reputation: 7,685

Post » Sun Jun 01, 2014 3:22 am

Oh sorry!
Here's a screen cap of my events page. As it stands, both 'Thruster_L' and 'Thruster_R' as well as 'Ship_Hull' all have both the 'Pin' behaviour, and the 'physics' behaviour. At the moment I propel the thrusters using the 'Move Forward' action. That in itself works fine, as does the selective engagement of each individual thruster. The problem lies with how this effects the sprite 'Ship_Hull', because I can't seem to get it to react as though it was in freefall / zero gravity and have it manipulated by the thrusters.

Image

Sorry this is so vague!
B
4
Posts: 14
Reputation: 243

Post » Sun Jun 01, 2014 5:37 am

UM ok....welll its hard to figure out ..but things I would change considering its a spaceship are.

1- in the system every tick event --> there is no need to pin objects like the thrusters here because PIN already is an every tick function...
you should make a new event before this everytick event
System -> on start of layout ....then place all of your pin actions here not in the every tick event
also make your PIN action( position only) rather than rope style..pretty sure that will help alot
because rope style is for having something drag behind the object its pinned to..
Position only style will allow rotation of the thruster relative to the Spaceship hull and allow directional vectoring

2- it seems you are NOT really using the Physics motion for the thrusters..
YOu may of wanted this as a feature its had to tell from here ..but normally if you press w to thrust forward..
what you would do is rather than move the thusters 2 pixels instead use the physics behavior to "apply force at angle" while "w" is down. this will give you the thruster like movement that I think you are after..

also....one other way would be to ..
on "w" pressed...apply a uniform physics force to all engines...
then when you hold "q" or "e" down ->apply an extra physics force to the correct and relative thruster.. eg: q for left or e for right thruster or reversed
this way..you would still have forward motion but the additional physics force on either the left or right thruster would or should slightly turn the spaceship in the direction you want..

but yeah first off i would fix the every tick functions and make them -> on start of layout..
pin behaviour is already every tick...no point doubling up on commands for your processor if you dont need to...

youll probably find it works alot better too if you pin (position only) rather than rope style
somewhere on the tutorial page or in the example scenes in construct 2 is a test showing you how each PIN style works....im pretty sure its in the examples when you load a scene in construct 2

hope that helps
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
35
S
13
G
8
Posts: 318
Reputation: 7,685

Post » Sun Jun 01, 2014 6:03 am

That's helping a lot thanks! I'm fiddling around with the physics at the moment, however I've run into another problem, as soon as the layout starts, the sprites with the physics behaviour attached fall to the bottom, as if affected by gravity. Is there a way I can turn this off?
B
4
Posts: 14
Reputation: 243

Post » Sun Jun 01, 2014 9:55 am

In the Properties f the object you can can set it Immovable or just disable and enable physics via your event sheet whenever you need to....
keeping in mind that the event sheet is processed about 60 times a sec...you should have plenty of time each second to turn things on or off as needed

just put in a few extra commands as you need them

and dont forget to play around with the Global gravity settings..can lead to cool stuff happening...like simulating gravity vortexes and you can link this to time scale events as well to slow down the entire game if you are caught in a vortex...haha
When in doubt..or you are lost in a Zombie apocalypse or someone is giving you a hard time..Remember one thing..... Read the Construct 2 Manual..it will save your life.:)
B
35
S
13
G
8
Posts: 318
Reputation: 7,685

Post » Sun Jun 01, 2014 10:32 am

Oh really? That's a thought too keep in mind! I'll check those out!

Thanks so much for all your help!
B
4
Posts: 14
Reputation: 243

Post » Sun Jun 01, 2014 10:45 am

Okay, so I have the thruster aspect working, and they now function relatively well while attached to the ship's hull. Do you know how I could set up a 'pivot point' effect for the hull, so that if a single thruster is engaged, the ship will rotate accordingly? (E.g if the left thruster is engaged, the ship rotates clockwise accordingly?)
B
4
Posts: 14
Reputation: 243


Return to How do I....?

Who is online

Users browsing this forum: ksiads and 1 guest