Physics Help for a Game

I’m making a game that is semi-similar to Terraria and I’m wondering how to do the gravity/physics. I have a beta here. Thanks in advance!


@CodeHelp

11 Likes

What if you just did physics normally? Would it work ok?

4 Likes

What do you mean, normally? Have you looked at the project?

4 Likes

Yes. If you look at the link, there’s a 1 next to it.

4 Likes

Oh. Yeah. I’m really not that great with any kind of physics.

4 Likes

As in, when 7 = 7 increase vertical velocity or whatever by -1 or something. Then have collisions for the character.

3 Likes

I’ll put together a little example in the game and remix it.

2 Likes

Hmm… Maybe? Collisions are the laggiest thing ever though.

3 Likes

It’s not that laggy.


@MISSION_IMPOSSIBLE

5 Likes

So I took Hopscotchers code and changed it a little, and made jumping work semi properly, (shake to jump) so I got that sort of down for you, but you will still have to perfect it. (Btw good job so far! This is really cool!)

6 Likes

Kinda? I don’t really want him to be bouncing, and I think there’s a better way. I’m just not sure what.

5 Likes

Thanks! I’m pretty happy with what I’ve done so far, and I appreciate you making that but I just made a jumping system I like so I might keep using that.

5 Likes

Looks like you have gotten help with lots of stuff. If you still neeed more help though, feel free to ask!

6 Likes

Yeah… I would prefer not to use when bumps as I feel that would be a cleaner solution but I don’t know how to work out when all the clones aren’t touching the person, and then make gravity come into play.

7 Likes

Oh. I don´t think that I know how to solve your problem, because I haven´t really done much physics in Hopscotch. Sorry!

3 Likes

You know of square collisions right?

2 Likes

Ummm… No? Do you mean detecting if the distance between two objects is < something?

2 Likes

I can help you @MISSION_IMPOSSIBLE, if you still need help, tag me!

2 Likes

(When (cube)is touching (air))
(Check once if (d=1))
(Change y by (-2))
(Else)
————————————-
(When (cube) is touching (ground))
(Set (d) to (1))
————————————-
(When (cube) is touching (ground))
(Repeat forever)
(Check once if (d≠1)
(Set (d) to (1))
(Else)
(Set (d) to (0))

Here! @MISSION_IMPOSSIBLE

1 Like

Another idea? Not sure if it would work, but

When 7=7
(Check Once If (D=1)
Increase Y by -2
—————————
When (Cube) is touching (Ground)
Set D to 0
—————————
When (Cube) is touching (Air)
Set D to 1
—————————
When 7=7
Check If (D=1)
Change Y by Y
(Else)
Set Y to 0

1 Like