Discuss Scratch

PixelMonado
Scratcher
38 posts

Andvanced physics with Bouncing objects.

Okay, to make this easy I'm going to just make a little drawing on how I want it to be able to bounce:
(This is the path I want it to go in. The right line is a wall
____ \ |
/ \ ___\|
___/ \__/ |
So basically, I need it to have gravity, and to be able to bounce off any surface and rebound at a random angle.

Last edited by PixelMonado (May 14, 2016 21:18:50)


Hello. I'm the guy you don't notice that makes awesome projects.
TIME TO TURN THE TABLES. (ノಠ益ಠ)ノ彡┻━┻ (ಠ_ಠ)
(•_•)
( •_•)つ⌐■-■
(⌐■_■) Mission control, we have achieved awesomeness.
“lol” - the biggest lie on the internet. You're not really laughing out loud. And you know it.
uglypigman2000
Scratcher
45 posts

Andvanced physics with Bouncing objects.

I think it was
when green flag clicked
forever

if <touching sprite > then

end


end

end
uglypigman2000
Scratcher
45 posts

Andvanced physics with Bouncing objects.

wait, no… it was
when green flag clicked
forever

if on edge, bounce
end
uglypigman2000
Scratcher
45 posts

Andvanced physics with Bouncing objects.

yep it was.

well, no… it was for a pong game.

(too bad :()
DragonTMD
Scratcher
100+ posts

Andvanced physics with Bouncing objects.

I Don't Really Know How To, But Try This…If You Mean Something Different, Please Tell Me

Gravity:
forever
if <not <<touching [Path v] ?> or <touching color [#ff0088] ?>>> then
change y by (-1)
end
end

Jumping:
if <<<touching [Path v] ?> or <touching color [#ff0088] ?>> and <key [Up v] pressed?>> then
repeat ()
change y by (1)
end
end

Hey There! You can call me Dragon!
I like Helping People! Tell me if you need help!

Status:
Programming - Decent
Posts - 140+
DragonTMD
Scratcher
100+ posts

Andvanced physics with Bouncing objects.

Ya, That Is For Those Pong Games Or Whatever Everybody Calls It

Hey There! You can call me Dragon!
I like Helping People! Tell me if you need help!

Status:
Programming - Decent
Posts - 140+
DragonTMD
Scratcher
100+ posts

Andvanced physics with Bouncing objects.

Oh, And About Bouncing, I Know 0% Of It XD

Hey There! You can call me Dragon!
I like Helping People! Tell me if you need help!

Status:
Programming - Decent
Posts - 140+
PixelMonado
Scratcher
38 posts

Andvanced physics with Bouncing objects.

Yeah, I'm not looking for things like pong. Think like you just threw a ball at the ground, then it bounced up and hit a wall, and so on.

Hello. I'm the guy you don't notice that makes awesome projects.
TIME TO TURN THE TABLES. (ノಠ益ಠ)ノ彡┻━┻ (ಠ_ಠ)
(•_•)
( •_•)つ⌐■-■
(⌐■_■) Mission control, we have achieved awesomeness.
“lol” - the biggest lie on the internet. You're not really laughing out loud. And you know it.
uglypigman2000
Scratcher
45 posts

Andvanced physics with Bouncing objects.

DragonTMD wrote:

I Don't Really Know How To, But Try This…If You Mean Something Different, Please Tell Me

Gravity:
forever
if <not <<touching [Path v] ?> or <touching color [#ff0088] ?>>> then
change y by (-1)
end
end

Jumping:
if <<<touching [Path v] ?> or <touching color [#ff0088] ?>> and <key [Up v] pressed?>> then
repeat ()
change y by (1)
end
end


I MEAN BOUNCING OFF NOT JUMPING OR GRAVITY
DragonTMD
Scratcher
100+ posts

Andvanced physics with Bouncing objects.

Hey Hey Hey, Calm Down Dude, Im Not Talking to You, But If Your Helping That Guy Or Something, Then You Could Just Tell Me Nicely Instead Of Telling Me Madly…

I Think I Understand What You Mean, Do You Mean You Want The Player To Bounce When It Touches The Path Or Something?
Or Do You Want It To Bounce Like A Ball When Hitting The Ground After Falling?
Oooor Do You Want To Make A Platformer But You Didn't Knew How?
Sorry If Those Are Like Nothing To Do With Your Main Question
Anyways, Could You Please Explain What You Really Want?

Tryin To Be Nice Here…

Hey There! You can call me Dragon!
I like Helping People! Tell me if you need help!

Status:
Programming - Decent
Posts - 140+
PixelMonado
Scratcher
38 posts

Andvanced physics with Bouncing objects.

Okay, wait.
What I'm trying to do is make a grenade physics thing for a collaborative project ( https://scratch.mit.edu/studios/2046511/ )
and so what I want is for it to be able to bounce off of walls and the floor after being thrown, for example. And yes, it's for a platformer. Just imagine a ball being thrown at the floor, then bouncing up and hitting a wall, and then bouncing back to you and stuff. I'm basically looking for a way for a physics
script(s) that makes things bounce when they hit other surfaces.

Last edited by PixelMonado (May 15, 2016 13:18:13)


Hello. I'm the guy you don't notice that makes awesome projects.
TIME TO TURN THE TABLES. (ノಠ益ಠ)ノ彡┻━┻ (ಠ_ಠ)
(•_•)
( •_•)つ⌐■-■
(⌐■_■) Mission control, we have achieved awesomeness.
“lol” - the biggest lie on the internet. You're not really laughing out loud. And you know it.
DragonTMD
Scratcher
100+ posts

Andvanced physics with Bouncing objects.

Oh, I See what You Mean
How About This?
For Moving Vertical
if <touching [Ground v] ?> then
point in direction ((0) - (direction))
end
For Moving Horizontal
if <touching [Wall v] ?> then
point in direction ((180) - (direction))
end
To Make It Actually Jump Off, Your Gonna Have To Figure That Out Yourself, Cuz Im Not Sure How To…
Maybe Like This?
if <touching [Ground v] ?> then
point in direction ((0) - (direction))
repeat ()
move () steps
end
end

Hey There! You can call me Dragon!
I like Helping People! Tell me if you need help!

Status:
Programming - Decent
Posts - 140+
PixelMonado
Scratcher
38 posts

Andvanced physics with Bouncing objects.

DragonTMD wrote:

Oh, I See what You Mean
How About This?
For Moving Vertical
if <touching [Ground v] ?> then
point in direction ((0) - (direction))
end
For Moving Horizontal
if <touching [Wall v] ?> then
point in direction ((180) - (direction))
end
To Make It Actually Jump Off, Your Gonna Have To Figure That Out Yourself, Cuz Im Not Sure How To…
Maybe Like This?
if <touching [Ground v] ?> then
point in direction ((0) - (direction))
repeat ()
move () steps
end
end
Hmm… It's not quite what I'm looking for, because I need to incorporate gravity and velocity. I'll try to modify it, though.

Last edited by PixelMonado (May 15, 2016 13:59:44)


Hello. I'm the guy you don't notice that makes awesome projects.
TIME TO TURN THE TABLES. (ノಠ益ಠ)ノ彡┻━┻ (ಠ_ಠ)
(•_•)
( •_•)つ⌐■-■
(⌐■_■) Mission control, we have achieved awesomeness.
“lol” - the biggest lie on the internet. You're not really laughing out loud. And you know it.
mstone326
Scratcher
1000+ posts

Andvanced physics with Bouncing objects.

Check the scripts on the hammer brother hammer in my scrolling bad guy placement examples. That hammer has velocity and gravity. You could probably add the koopa bouncing scripts for the floor but have it continually bounce less as it slows down. Then work out something similar for the bouncing off the wall or edge.

https://scratch.mit.edu/projects/108361157/

High School Athletic Director / Middle School Tech Teacher / High School Baseball Coach
Kung Fu by Nintendo 1984 - https://scratch.mit.edu/projects/369994801/
Taco Defense - Speed Typing - https://scratch.mit.edu/projects/316795450/
Halloween Boss Battle - Taking Back our Woods - https://scratch.mit.edu/projects/257155118/
Almost Pong - https://scratch.mit.edu/projects/656276979/
Studio - My Best Projects - https://scratch.mit.edu/studios/4125978/
Forum Help Project Examples - https://scratch.mit.edu/studios/4133335
uglypigman2000
Scratcher
45 posts

Andvanced physics with Bouncing objects.

and about gravity… I know 0% XD
FruitFuzzy
Scratcher
3 posts

Andvanced physics with Bouncing objects.

the gravity is pretty simple but i can see it being confusing. just make a variable to remind you that it changes your Y coordinate, leyts called Yy. so we have Yy and lets say if not touching color black then it changes Yy by -1 or whatever gravity strengh you want. and then make a script that makes the sprite change by Yy. so “forever change Y by Yy” so then when it DOES touch the color black then it sets Yy to zero to represent you have touched something. so then when you arent touching a color or something then what it does is it makes the gravity stronger to show you have been falling faster and accelerating. so when you want to jump just make a script that changes Yy by however much you want your character to jump.
PixelMonado
Scratcher
38 posts

Andvanced physics with Bouncing objects.

FruitFuzzy wrote:

the gravity is pretty simple but i can see it being confusing. just make a variable to remind you that it changes your Y coordinate, leyts called Yy. so we have Yy and lets say if not touching color black then it changes Yy by -1 or whatever gravity strengh you want. and then make a script that makes the sprite change by Yy. so “forever change Y by Yy” so then when it DOES touch the color black then it sets Yy to zero to represent you have touched something. so then when you arent touching a color or something then what it does is it makes the gravity stronger to show you have been falling faster and accelerating. so when you want to jump just make a script that changes Yy by however much you want your character to jump.
I'm not looking for a jumping script, a BOUNCING script. Like when you throw a ball?

Hello. I'm the guy you don't notice that makes awesome projects.
TIME TO TURN THE TABLES. (ノಠ益ಠ)ノ彡┻━┻ (ಠ_ಠ)
(•_•)
( •_•)つ⌐■-■
(⌐■_■) Mission control, we have achieved awesomeness.
“lol” - the biggest lie on the internet. You're not really laughing out loud. And you know it.
Mikhail777999
Scratcher
1 post

Andvanced physics with Bouncing objects.

eleventyOne
Scratcher
82 posts

Andvanced physics with Bouncing objects.

PixelMonado wrote:

FruitFuzzy wrote:

the gravity is pretty simple but i can see it being confusing. just make a variable to remind you that it changes your Y coordinate, leyts called Yy. so we have Yy and lets say if not touching color black then it changes Yy by -1 or whatever gravity strengh you want. and then make a script that makes the sprite change by Yy. so “forever change Y by Yy” so then when it DOES touch the color black then it sets Yy to zero to represent you have touched something. so then when you arent touching a color or something then what it does is it makes the gravity stronger to show you have been falling faster and accelerating. so when you want to jump just make a script that changes Yy by however much you want your character to jump.
I'm not looking for a jumping script, a BOUNCING script. Like when you throw a ball?
Are you trying to implement real-world physics into your bouncing thing? or just like a simple bounce script with very low gravity because real-world physics might be inefficient

Last edited by eleventyOne (March 14, 2020 06:01:22)


>be me
>like puffins and cute birbs a lot
aquabeast792
Scratcher
3 posts

Andvanced physics with Bouncing objects.

I just want to know, How do you get the Player to bounce off the Ground?

Powered by DjangoBB