to make gravity in your platformer, use these scripts
when flag clicked forever if <not <touching color [ground color]?>> change [y velocity v] by (-0.4) end change y by (y velocity)
when flag clicked set [y velocity v] to (0) forever if <touching color [ground color]?> set [y velocity v] to (0) wait until <not <touching color [ground color]?>> end
when [space v] key pressed if <touching color [ground color]?> set [y velocity v] to (9) end
Offline
Awesome. You can do this too:
whengfclicked Forever If <touching color [ground color]?> Change y by (2) Else Change y by (-1) End End Stop script
Last edited by KrIsMa (2012-01-29 12:57:43)
Offline
I prefer:
when green flag clicked set (y velocity) to [0] forever if <touching color [#36E813]?>//Change the colour in this block to the colour of the ground. if <key [up arrow v] pressed?> set [y velocity v] to (10) else set [y velocity v] to (1) end else change [y velocity v] by (-1) end change y by (y velocity) end
Last edited by RedRocker227 (2012-03-14 15:52:27)
Offline
RedRocker227 wrote:
I prefer:
when green flag clicked set (y velocity) to [0] forever if <touching color [#36E813]?> if <key [up arrow v] pressed?> set [y velocity v] to (10) else set [y velocity v] to (1) end else change [y velocity v] by (-1) end change y by (y velocity) end
thats what i use, or something similar to that
Offline
RedRocker227 wrote:
I prefer:
when green flag clicked set (y velocity) to [0] forever if <touching color [#36E813]?> if <key [up arrow v] pressed?> set [y velocity v] to (10) else set [y velocity v] to (1) end else change [y velocity v] by (-1) end change y by (y velocity) end
My newer method used here is based off of this, but uses the new variable "energy" to determine the power of the jump. Other than that, I usually use this one.
Offline
RedRocker227 wrote:
I prefer:
when green flag clicked set (y velocity) to [0] forever if <touching color [#36E813]?> if <key [up arrow v] pressed?> set [y velocity v] to (10) else set [y velocity v] to (1) end else change [y velocity v] by (-1) end change y by (y velocity) end
I find that a set y velocity to 0 block works better then a set y veloctiy to 1 block.
Offline
catfan8 wrote:
RedRocker227 wrote:
I prefer:
when green flag clicked set (y velocity) to [0] forever if <touching color [#36E813]?> if <key [up arrow v] pressed?> set [y velocity v] to (10) else set [y velocity v] to (1) end else change [y velocity v] by (-1) end change y by (y velocity) endI find that a set y velocity to 0 block works better then a set y veloctiy to 1 block.
But then the sprite won't be able to rise to the top of the ground when it goes under
Offline
RedRocker227 wrote:
catfan8 wrote:
RedRocker227 wrote:
I prefer:
when green flag clicked set (y velocity) to [0] forever if <touching color [#36E813]?> if <key [up arrow v] pressed?> set [y velocity v] to (10) else set [y velocity v] to (1) end else change [y velocity v] by (-1) end change y by (y velocity) endI find that a set y velocity to 0 block works better then a set y veloctiy to 1 block.
But then the sprite won't be able to rise to the top of the ground when it goes under
Yes, but I've tested it to find that it doesn't go under either. As long as you have decent collison detection, it works great.
Offline
KrIsMa wrote:
Awesome. You can do this too:
whengfclicked Forever If <touching color [ground color]?> Change y by (2) Else Change y by (-1) End End Stop script
I don't get it. You can't put anything after a "C Forever Block".
Offline
jontmy00 wrote:
KrIsMa wrote:
Awesome. You can do this too:
whengfclicked Forever If <touching color [ground color]?> Change y by (2) Else Change y by (-1) EndI don't get it. You can't put anything after a "C Forever Block".
don't put the end on forever
fixed the script
Offline
Hello, I'm new here. I'm having a little bit of trouble with creating a game. It has to do with firstly my life variable and making the character's life varaible decrease by five when he is touching the baddies. Can you help me?
Offline
MikeBrain19 wrote:
Hello, I'm new here. I'm having a little bit of trouble with creating a game. It has to do with firstly my life variable and making the character's life varaible decrease by five when he is touching the baddies. Can you help me?
when gf clicked forever if <touching [baddie v]> change [lives v] by (-5) wait until <not <touching [baddie v]>> end end
Last edited by HD123 (2012-06-17 08:18:48)
Offline
is it possable to make x volocity in a scrolling game?
Offline
Why not make your own topic? You're more likely to get better help and advice.
And yes, you can by using variables. Make whatever keys you are using, then get the keys to change the variable, then get it to move variable steps.
Offline
I have tried the first and third of these scripts and neither seem to work. The first one, nothing happened AT ALL and the third, the sprite floated up and up and didn't stop until it reached the top of the screen.
Offline
pinnipediator wrote:
I have tried the first and third of these scripts and neither seem to work. The first one, nothing happened AT ALL and the third, the sprite floated up and up and didn't stop until it reached the top of the screen.
Make sure you have every block and script, because every single one is needed.
Offline
30-1 wrote:
The best place to find help for this is on the scratch wiki.
Necropost: Your post and the last post was 1 month away. This is called necroposting. This is frowned by the ST.
Thanks.
Offline
KrIsMa wrote:
30-1 wrote:
The best place to find help for this is on the scratch wiki.
Necropost: Your post and the last post was 1 month away. This is called necroposting. This is frowned by the ST.
Thanks.
Not if the post is still relevant, which in this case, it still looks pretty relevant to me.
We actually frown upon attacking others about necroposting when it might not be the case. It's just better to flag the comment and let the Scratch Team decide if it's a bad necropost or not.
Offline
cheddargirl wrote:
KrIsMa wrote:
30-1 wrote:
The best place to find help for this is on the scratch wiki.
Necropost: Your post and the last post was 1 month away. This is called necroposting. This is frowned by the ST.
Thanks.Not if the post is still relevant, which in this case, it still looks pretty relevant to me.
We actually frown upon attacking others about necroposting when it might not be the case. It's just better to flag the comment and let the Scratch Team decide if it's a bad necropost or not.
To me, it looks very irrelevant, cause its old and there is a lot of answers already.
Offline
KrIsMa wrote:
cheddargirl wrote:
KrIsMa wrote:
Necropost: Your post and the last post was 1 month away. This is called necroposting. This is frowned by the ST.
Thanks.Not if the post is still relevant, which in this case, it still looks pretty relevant to me.
We actually frown upon attacking others about necroposting when it might not be the case. It's just better to flag the comment and let the Scratch Team decide if it's a bad necropost or not.To me, it looks very irrelevant, cause its old and there is a lot of answers already.
Not to me. Old doesn't mean the thread itself is closed to posting. Next time, it's better to just report the post and let the Scratch Team handle it.
Offline