Hello!
I made my first scrolling game recently. Here is the link:
http://scratch.mit.edu/projects/Scarstar999/1557614
Someone suggested that I put in a script that says the sprite can jump only if it is touching black. I tried to do it, but it didn't quite work out. Will someone take a look at the scripts of my project and help me? The script looks like this:
What did I do wrong?
Any advice will be appreciated! Thanks!
~Scarstar
Offline
I would suggest doing it like this:
[blocks]<when green flag clicked>
<forever>
<if><touching color[ black
<if><key[ up arrow ]pressed?>
<change y by( 10
<end>
<change y by( 1
<else>
<change y by( -1
<end>
<end>[/blocks]
That way, it moves up if touching black, lots if jumping, and down if not.
Offline
You need a forever loop around it, or it just checks at the beginning to see if its touching black
Offline
Here is the script I use:
When flag is clicked
Forever
If key up arrow key is pressed
if touching color black
repeat 10
change y by 10
when flag is clicked
repeat untill tounching color black
change Y by -4
Offline
nickbrickmaster wrote:
You need a forever loop around it, or it just checks at the beginning to see if its touching black
Yeah, I tried that, but it still jumps.
Offline
Do it like:
When Green Flag Pressed Forever If Up Arrow is Pressed Then If Touching Black Then Change Y by 10 Else Else
Offline
Okay, thanks for evryone's help!!!
Offline