Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Gravity!!!!!!!!!
- trudiefaye
- Scratcher
2 posts
Gravity!!!!!!!!!
I need help with making a smooth good gravity in my game. I tried one thing….
Thanks!!!!
[i]when green flag clicked
if <touching color [#0fff6e] ?> then
set [ gravity] to [0]
else
change [ gravity] by (-0.1)
end
when green flag clicked
forever
change y by (gravity)
end[/i]
Thanks!!!!
- matthewparkerstas
- Scratcher
65 posts
Gravity!!!!!!!!!
Instead of
when green flag clickedyou should try
if <touching color [#0fff6e] ?> then
set [ gravity] to [0]
else
change [ gravity] by (-0.1)
end
when green flag clicked
forever
change y by (gravity)
end[/i]
when green flag clicked
if <touching color [#0fff6e] ?> then
set [ gravity] to [0]
else
set [ gravity] to [1]
end
when green flag clicked
forever
if <[gravity] = [1]> then
repeat until <touching color [#0fff6e] ?>
change y by (3)
end
end
It's free real estate
50th post on February 5th, 2018
- TromboneAndSaxophone
- Scratcher
91 posts
Gravity!!!!!!!!!
How is that supposed to create a gravity effect?when green flag clicked
if <touching color [#0fff6e] ?> then
set [ gravity] to [0]
else
set [ gravity] to [1]
end
when green flag clicked
forever
if <[gravity] = [1]> then
repeat until <touching color [#0fff6e] ?>
change y by (3)
end
end
How about
when green flag clicked
set [ gravity v] to [0]
forever
change [ gravity v] by (-1)
change y by (gravity)
check for ground :: custom
end
define check for groundWhen you make the custom block, click “options”, then click the check box for “run without screen refresh”. It will run faster.
if <touching color [#379d59] ?> then
set [ gravity v] to [0]
if <(gravity) > [0]> then
repeat until <not <touching color [#379d59] ?>>
change y by (-1)
end
else
repeat until <not <touching color [#379d59] ?>>
change y by (1)
end
Last edited by TromboneAndSaxophone (Jan. 3, 2018 16:00:40)
- Charles12310
- Scratcher
1000+ posts
Gravity!!!!!!!!!
How is that supposed to create a gravity effect?when green flag clicked
if <touching color [#0fff6e] ?> then
set [ gravity] to [0]
else
set [ gravity] to [1]
end
when green flag clicked
forever
if <[gravity] = [1]> then
repeat until <touching color [#0fff6e] ?>
change y by (3)
end
end
How aboutwhen green flag clicked
set [ gravity v] to [0]
forever
change [ gravity v] by (-1)
change y by (gravity)
check for ground
enddefine check for groundThe red block is supposed to be purple, but I don't know how to fix that. When you make the custom block, click “options”, then click the check box for “run without screen refresh”. It will run faster.
if <touching color [#379d59] ?> then
set [ gravity v] to [0]
if <(gravity) > [0]> then
repeat until <not <touching color [#379d59] ?>>
change y by (-1)
end
else
repeat until <not <touching color [#379d59] ?>>
change y by (1)
end
check for ground :: custom
check for ground :: custom
Fixed.
A few internet communication companies want to corrupt the internet by getting rid of net neutrality. Stop Them!
- Discussion Forums
- » Help with Scripts
- » Gravity!!!!!!!!!