How do I make a two thruster space-craft?

0 favourites
  • 8 posts
From the Asset Store
Template for maintaining an inventory with crafting possibilities. Completely documented in text and video.
  • 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!

  • 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..

  • 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.

    Sorry this is so vague!

  • 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

  • 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?

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Oh really? That's a thought too keep in mind! I'll check those out!

    Thanks so much for all your help!

  • 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?)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)