How do I make a TotM mechanic?

0 favourites
  • 12 posts
  • How do I make a mechanic similar to that to Tomb of the Mask, where the player swipes, causing the character to move in that direction, then make then stick to walls?

  • You can use bullet behavior. On collision with walls set player bullet speed to 0 again

  • mrcgkh I tried that but it doesn't work. Can you show me a capx

  • Why would Bullet not work ?

    You know the 'X,Y' of the starting Touch. You know the 'X,Y' when Touch ends.

    There is a system expresssion 'angle'.

    And the Bullets angle of movement can be set.

    What are you missing ?

  • Why would Bullet not work ?

    You know the 'X,Y' of the starting Touch. You know the 'X,Y' when Touch ends.

    There is a system expresssion 'angle'.

    And the Bullets angle of movement can be set.

    What are you missing ?

    I think it's my right swipe, because it always goes right when i'm not swiping, so...

  • Post a capx of you trying the bullet ?

  • On touch end, bullet set angle of motion to int(touch.angle/90)*90

  • you mean like this? Demo NinjaMiner

    you can do it by using the platformer behavior and when u press right change the gravity angle towards 0 when u press left change world gravity angle towards 180 270 up 90 down. make sure only the player has the platformer behavior and the walls to be solids (solid behavior)and thats it.

    now if you dont use controls and u use touch to determine the direction of which u swipe towards you can calculate the angle of the initial x y of the touch and the release ... as specified above.

    the speed you can increase it by setting the value of gravity pull or fall to a higher number test and retest till u get it as you want ... have fun.

    download TOTM example capx movement using platformer behavior. i used newt 's angle detection since the touch plugin has no .angle expression i created 2 variables that are saved on any touch start then on any touch end newt's code works good as long as you dont rush the movement... its inaccurate sometimes... but you can fix it... by adding a 4 way condition check for angles... when touch ends... check if its between angles etc...

  • I mean exactly that, but the problem with the capx you posted is that sometimes the swipes get mixed up and here's the capx of what i have

    uphttps://www.dropbox.com/s/zzhcxg546z4 ... .capx?dl=0

  • Sorry

    AngleAt(index) or AngleForID(id)

    And yes you need to make sure its a swipe type of movement, a single touch wont get a proper angle.

    Several ways to do that.

    SpeedAt(index) or SpeedForID(id) would be another method.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Sorry

    ......

    lol dont mention it man, nothing to be sorry you actually helped a lot with that line of code is awesome... all he has to do is to detect which way the touch is dragged first time.. left right up or down... but for sure speedat(index) will solve it

    srry dont have time to assembley the entire capx for u, but hope this sections help you.

    i know there is a tutorial using that for swipe movement. 1 of them being this one and then there is this section dedicated to swipes and swipe movements with the entire variations of ways on how to make it happen.

    its just a matter of making the swipe happen in straight lines and not detect the between angles and ur done. ur 90% there. good luck.

  • My best bet:

    tomb_miner.capx

    You can stick your finger around while playing!

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