How do I make a TotM mechanic?

Get help using Construct 2

Post » Thu Apr 14, 2016 10:15 pm

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?
B
25
S
6
G
4
Posts: 173
Reputation: 3,933

Post » Fri Apr 15, 2016 9:36 pm

You can use bullet behavior. On collision with walls set player bullet speed to 0 again
B
21
S
8
G
6
Posts: 177
Reputation: 8,134

Post » Sat Apr 16, 2016 1:43 pm

@mrcgkh I tried that but it doesn't work. Can you show me a capx
B
25
S
6
G
4
Posts: 173
Reputation: 3,933

Post » Sat Apr 16, 2016 3:27 pm

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 ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Apr 18, 2016 9:38 am

99Instances2Go wrote: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...
B
25
S
6
G
4
Posts: 173
Reputation: 3,933

Post » Mon Apr 18, 2016 3:30 pm

Post a capx of you trying the bullet ?
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Mon Apr 18, 2016 3:59 pm

On touch end, bullet set angle of motion to int(touch.angle/90)*90
Last edited by newt on Mon Apr 18, 2016 4:04 pm, edited 1 time in total.
Image ImageImage
B
169
S
50
G
170
Posts: 8,292
Reputation: 108,728

Post » Mon Apr 18, 2016 4:02 pm

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...
B
75
S
22
G
69
Posts: 1,341
Reputation: 43,779

Post » Mon Apr 18, 2016 7:34 pm

@gamecorpstudio 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
B
25
S
6
G
4
Posts: 173
Reputation: 3,933

Post » Mon Apr 18, 2016 9:20 pm

@gamecorpstudio
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.
Image ImageImage
B
169
S
50
G
170
Posts: 8,292
Reputation: 108,728

Next

Return to How do I....?

Who is online

Users browsing this forum: Cub3D, David181, yiuyiu6666 and 22 guests