Physics Help for a Game

physics

#1

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


#2

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


#3

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


#4

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


#5

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


#6

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


#7

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


#8

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


#9

It’s not that laggy.


@MISSION_IMPOSSIBLE


#10

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!)


#11

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


#12

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.


#13

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


#14

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.


#15

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


#16

You know of square collisions right?


#17

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


#18

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


#19

(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


#21

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