Jumping/Flying physics


#1

Calling out to the masses again. I know @Intellection74 and @Stradyvarious might be able to help and this is what I have problems doing:

Alright- So imagine if a sub-par physics engine turned on. This would mean a repeat forever, change y by -5 or whatever. I need something that when you press the up button, depending on how long you press, will rise you by 100, to 125, 150, etc. but like the max is 200px. And you can't do this again until you hit like a platform/ground. Any ideas?
Thanks, paz


#2

This post was flagged by the community and is temporarily hidden.


#4

Hmm... @Intellection74 I may be misinterpiting, but a problem is I don't see said value be changed to one in air, plus, that only raises by a set number, and not by how long you pressed (again, I wouldn't need help if Hopscotch just added preset values of pressed and tapped (t/F)


#5

This post was flagged by the community and is temporarily hidden.


#6

Here's the problem- I need it so it goes up so high depending on how long you press a button. Your tutorial is great, but I don't think it's what I need atm


#7

I helped someone yesterday with a similar problem.

Repeat forever
If VALUE is greater than 0
Increase VALUE by -1

When up arrow is pressed set VALUE to 7

When VALUE is not equal to 0
Change y by ??(25)

(set speed to 20 or something for the object at start)

Repeat forever
If OBJECTS y position is greater than ???( y position of ground)
Change y by -5

Hope you can understand this
Its best not to use odd numbers.

you can make like a fuel meter

Repeat forever if FUEL is less than 100
increase fuel by 1 wait 1 sec

when up arrow is pressed
if FUEL is greater than 0
if y position is less than ?? Roof
change y by ??
increase FUEL by -1


#8

@Stradyvarious thats sorta of what I have atm, But, I only want it to move up when you press the button, if you hold the button for longest, you go up high(at a max though), just tapping it would do a small hop. This goes up indefinitly


#10

THe first code i listed before the fuel code will work.


#11

Well, more of a max hop. The jumps won't go to the roof, imagine if you do this

Tap up:
move 25 up
Hold up for small time:
move 60 up
hold up for a decent amount of time:
move 100 up
but that is the max, and you can't jump again until you hit the floor. How do I make it where you move up based on how long you move a button, but it's capped off after x amount of time (say 750 miliseconds of holding).

Like how in platformer games, the longer you hold the jump button the higher you go.


#12

https://c.gethopscotch.com/p/xrn6yqn5t

Check this.
You can adjust the speed the fuel goes up in the code and adjust the speed it decreases when the iPad is pressed as well as how high you go up.
Instead of capping the player has to wait for enough fuel to refill to go up.
the longer the player waits, the more fuel they have to go up higher


#13

@Stradyvarious I'l experiment with it.


#14

It doesn't seem to work for me. I tried the code, customized fuel, height changes, I'll try something different later.


#15

Welp @Stradyvarious Thing I was gonna try didn't work.
If you are still confused on what I'm trying to do watch like ~1 Min from where this video starts
--Spoiler for people who don't know what the last boss of undertale (geno route) is--