Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » I cant figure out colision
- 27xz
-
Scratcher
65 posts
I cant figure out colision
I recommend using a griffpatch tutorial if you don't understand at all, they usually help.
- CHESHT
-
Scratcher
27 posts
I cant figure out colision
define ground collisions
forever
if <touching [ground v] ?> then
repeat until <not <touching [ground v] ?>>
change y by (1)
end
end
end
when green flag clicked
forever
Ground Collisions
end
No screen refresh, more on griffpatch's platformer tutorial
I accidentally put a forever on the "define" block so just dont use that (it'll lag the project)
Last edited by CHESHT (April 10, 2024 23:39:40)
- -TUB-
-
Scratcher
100+ posts
I cant figure out colision
Hello @TheReal_GB613! It appears that you may posted this before you finished writing the body, but judging by the title of the post, it seems that you are trying to detect collisions in some way. May I suggest you look into the sensing category? There are many built-in blocks that may be helpful for you in your quest to detect collisions. I will summarize the usage of a few of them:
Of course, there are more complex ways of detecting collisions in situations where there are no sprites, but that is a topic for another time. I hope this post was enlightening and wish you well on your quest for collision detection!
<touching [sprite v] ?> // returns true if the current sprite is touching the sprite specified in the dropdown, false otherwise
<touching [mouse-pointer v] ?> // returns true if the current sprite is touching the mouse pointer, false otherwise
<touching [edge v] ?> // returns true if the current sprite is touching the edge of the stage, false otherwise
<touching color [#e6d8a6] ?> // returns true if the current sprite is touching the specified color, false otherwise
<color [#e6d8a6] is touching [#22bb03] ?> // returns true if the two specified colors are touching, false otherwise
Of course, there are more complex ways of detecting collisions in situations where there are no sprites, but that is a topic for another time. I hope this post was enlightening and wish you well on your quest for collision detection!
Last edited by -TUB- (April 11, 2024 00:58:16)
- Discussion Forums
- » Help with Scripts
-
» I cant figure out colision



