Control single sprite with two thumbsticks

From the Asset Store
Minimal Sprite Font with Stroke for Pixel Art games.
  • Hello! This is my first post after playing with Construct 2 for a little bit. I'm really impressed how quickly I was able to get up and running and throw together quick demos. I've read a few tutorials but I can't quite seem to get my head around this problem and wondered if anyone had any ideas.

    The game I'm making has two thumbsticks which I want to use to control a horizontal 'plate'. I'll only really use vertical controls on both thumbsticks, where the goal is to balance something on the plate. The left thumbstick should control the left hand side of the plate and the right thumbstick controls the right.

    What I think I need is some way to semi-independently control each 'end' of the plate, but can't quite fathom how to do that. Suggestions welcome!


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If the objective is to keep things balanced on the plate you could set the plate so it rotates/falls left or right randomly then have the player react by correcting the plates balance with the sticks.

    you could try something like

    Every Tick -------------- Plate Rotate random(-10,10) clockwise[/code:1t3ysl0j] that way the plate will rotate either 10 degrees left or right max. then check if the plate has fallen by doing something like 
    [code:1t3ysl0j]Plate angle >= 10 
    plate angle <= -10 -------------- destroy plate[/code:1t3ysl0j]
    I imagine you could even do this with the physics behavior and every tick check the plates angle and position however you'd probably need to do a lot more tweaking.
    As far as working with the joysticks goes, just add the gamepad input object into your project then go to Compare axis and check both their Y axis like so,
    [code:1t3ysl0j]Left analog Y axis = 100 
    Right analog Y axis = 100[/code:1t3ysl0j]
    Hope it helps!
  • Thanks for the reply. I don't actually want to control just the angle as it feels un-natural. The control I want is what you would have if you had one hand/finger under each end of the plate. You could lift the plate up vertically if you push both fingers together, and down if you pull down. But if you push one slightly up it would tilt that end of the plate. So it's a little more complicated than just rotating around an axis in the middle I think.

  • You could create two "Finger"-sprites which are controlled by the thumbsticks and have the plate either pinned by location only, or via physics revolute joint, or just set the angle of the plate to angle(fingerleft.x,fingerleft.y,fingerright.x,fingerright.y)

    Issue with the first two solutions is ofcourse that the plate becomes shorter in the horizontal direction when the angle get's bigger, but there are multiple ways to take that into account..

  • Thanks! I'll take a look at that.

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