How to check if Bike doing backflip/ frontflip?

Started by
4 comments, last by drago28 5 years, 11 months ago

I'm using construct 2 physics I have a working bike with everything setup and I'm able to do frontflip and backflip by adding angular velocity to the bike

I want to increase score/ add points and display the "backflip / frontflip" text when the bike does it.

so please help me I want to know the logic and how it's done.

p.s. example about construct 2 is not necessary, just explain me how other games do it or anything else you have to share :D

Thanks,

Drago

Advertisement

Detecting a flip is just a matter of checking if the bike is upside down, when it used to be right way up. Back flip vs front flip you can tell by the sign of the angular velocity.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

7 minutes ago, swiftcoder said:

Detecting a flip is just a matter of checking if the bike is upside down, when it used to be right way up. Back flip vs front flip you can tell by the sign of the angular velocity.

do you have access to construct, if yes I'll send you my capx file. actually I'm applying angular velocity to the chassis within a "while loop" based on how long the key is pressed down. i.e: add subtract -/+10 angular velocity when A or D is pressed.

2 hours ago, drago28 said:

do you have access to construct

I do not.

2 hours ago, drago28 said:

actually I'm applying angular velocity to the chassis within a "while loop" based on how long the key is pressed down. i.e: add subtract -/+10 angular velocity when A or D is pressed.

Ok, that makes it even easier, since you know by the key press which way they are flipping.

At the most basic, you just need to count how many times the bike passes 180 degrees rotation (assuming that 0º is upright). Then when they land, you award them that many back/front flips depending on which key they were holding.

Things get more complicated if you want to support both back and front flips in a single jump, but the core concept remains the same.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

On 4/19/2018 at 10:50 PM, swiftcoder said:

I do not.

Ok, that makes it even easier, since you know by the key press which way they are flipping.

At the most basic, you just need to count how many times the bike passes 180 degrees rotation (assuming that 0º is upright). Then when they land, you award them that many back/front flips depending on which key they were holding.

Things get more complicated if you want to support both back and front flips in a single jump, but the core concept remains the same.

Hey, Thanks for the help and sorry for the late reply. I was busy testing out your method 3days and wanted to come up with a solution and then post a reply, but Construct is limited and can't do things such easily or in a direct way when it comes to physics. I was tired and ready to shift to Unity, but before shifting to it I went on Construct forums and directly messaged a knowledgeable person and next day he replied with a post which had all what I wanted :D . the post content is tricky and has confusing math in it so I just copied it in my project and it works like a charm.

but, your method will be helpful when I'll shift to unity <3

again Thanks a lot :)

p.s. why is it showing "your content will need to be approved by a moderator" when replying or posting?

This topic is closed to new replies.

Advertisement