Check if else help

Hey does anyone know how to make it so I can use the check if else command to have gravity?

8 Likes

There’s a dedicated video under the science section that teaches you how to make a simple physics engine (including gravity)… (in hopscotch, tap videos > science > physics engine)

If you’re intending to make a platformer of some sort, feel free to use this template. All credit for physics goes to Spy Guy 96.

Basic LCPT v3.2

Note: do not upgrade the player version for any reason. The reason being it does not work well for player 2.x and above…

Welcome to the Forum, btw.

6 Likes

Hi I did this and it didn’t work how I wanted for the player model here’s the model to see if anyone can find help for it

https://c.gethopscotch.com/p/13noua580k

6 Likes

It uses the set position command with 2 different blocks so when I tried to import my code it didn’t work I also tried spy guy 69 templates and it didn’t work so I’m stuck

6 Likes

Easy fix: you just need to downgrade the player to 1.5.27 (the last player version where platformers are possible using check if else blocks).

This is due to a bug where 2 variables in conditionals causes an extra delay (which is why the player keeps clipping through the ground).

I can easily downgrade your project for you.

It’ll also run better (and be much less laggy) after the downgrade too.

3 Likes

I just downgraded the player for you. So it should work better after some tweaking…

https://c.gethopscotch.com/p/13npe5gtal

3 Likes

Thank but I meant in the spy guy templates it absolutely breaks. And when I did that template the code wouldn’t work I’m sure after enough researching I can get the collision to work for my model thanks for the help though I really appreciated it

5 Likes

But iirc (stands for If I Remember Correctly), all of Spy Guy 96’s templates use player 1.5.17… so there should be no reason why it doesn’t work as intended…

In order to make one on the modern player version, you would need to make use of equality operators in variable blocks (which can only be done via mods). I have suggested conditional values a while back, but what are the chances of it actually being added in the future?

@Spy_Guy_96 could tell you in more detail how his templates were made

and @/Tri-Angle could tell you how he managed to make one in player 2.0.0 and above…

3 Likes

Here’s what happens

https://c.gethopscotch.com/p/13npf2h8m9

3 Likes

You can’t actually use clones in the main player, it’ll just speed it up tenfold, which is the main reason for these glitches.

The reason is because each clone is changing some variables, and these do stack up rather quickly.

To “design” your character, you’ll need another object and position it relative to the actual player (aka player hitbox).

4 Likes

Thank you but I did figure it out

4 Likes

Hey I have another question I’m trying to make a game that stops after a certain amount of time and will stop setting text to score do you know any time variables or anything

3 Likes

I personally wouldn’t work on any hs project rn while it’s broken.

3 Likes

Ok I know but it works for me and I’m doing it for a competition

3 Likes

You can just have a variable decrease by 1 every 1 second till it reaches 0.

1 Like

I’m just saying when/ if they restore it everything u worked on while it was down will go poof.

1 Like

I know but if you can help i would like to know for future projects

3 Likes

Ok so you want the score to stop increasing when the timer runs out?

2 Likes

Yes

2 Likes

https://c.gethopscotch.com/p/13uf34d61e

1 Like