Discuss Scratch
- TheRealRldFan
- Scratcher
36 posts
Collision
I just need more examples of Collision with:
define Block name
- TheRealRldFan
- Scratcher
36 posts
Collision
is it 3D or 2D with pen?
[2D]
Last edited by TheRealRldFan (March 25, 2024 16:27:42)
- --CHA0S--
- Scratcher
100+ posts
Collision
What type of game is it, platformer?
Hi
Trying to become a forum helper
- TheRealRldFan
- Scratcher
36 posts
Collision
What type of game is it, platformer?
Move around game type <so move anywhere>
Last edited by TheRealRldFan (March 25, 2024 16:26:43)
- TheRealRldFan
- Scratcher
36 posts
Collision
I have 1 example:
define Collision (X) (Y)
change x by (X)
change y by (Y)
if <touching [Collision thing] ?> then
set x to (Previous X)
set y to (Previous Y)
end
Rest example in Shrek_on_donke’s profile [My freind basically]
Last edited by TheRealRldFan (March 25, 2024 16:24:42)
- TheRealRldFan
- Scratcher
36 posts
Collision
when green flag clicked
I do have a game shut down for a while due to collision!
- TheRealRldFan
- Scratcher
36 posts
Collision
say [I don’t have much examples and the set up for the block takes a while] for (x position) secs
Last edited by TheRealRldFan (March 25, 2024 16:44:56)
- Malicondi
- Scratcher
1000+ posts
Collision
You'll have to be a bit more specific on what you mean by collision, or we won't really be able to help.
post #1000 post #100 i help in the forums post #1 post #500 0 second ninja
I recommend reading jvvg's essay about the scratch team before complaining, as it may change your opinion and provide insight on the topic.
coming soon :)
I recommend reading jvvg's essay about the scratch team before complaining, as it may change your opinion and provide insight on the topic.
coming soon :)
- TheRealRldFan
- Scratcher
36 posts
Collision
Like when you touch something you can’t go past it You'll have to be a bit more specific on what you mean by collision, or we won't really be able to help.
- Wolf_Link21
- Scratcher
100+ posts
Collision
something like this? https://scratch.mit.edu/projects/989406212/
This is dave
:D :: hat :: motionHe protects my from evil kumquats.
Please follow me if you find my response helpful and give me any ideas for my game https://scratch.mit.edu/projects/992371983/
- ramenecho
- Scratcher
100+ posts
Collision
Ok so if you want something to collide with an object preventing it from moving past it, im assuming you want it to collide with a form of immovable wall, just make it so every time the sprite moves it checks to see if it is touching the object, and if so then you move with the opposite, example: I just need more examples of Collision with:define Block name
change x by (x velocity)I hope this helps!
change y by (y velocity)
if <touching [wall sprite v] ?> then
change x by ((-1) * (x velocity))
change y by ((-1) * (y velocity))
end
Last edited by ramenecho (March 25, 2024 17:26:37)
Hello there, this is a cool signature! You can even make your own wow! I really need somebody to check my game for bugs, MineQuest Idle its not the highest quality of games, but its an improvement from my previous ones
- --CHA0S--
- Scratcher
100+ posts
Collision
You could break it down a bit further to detect if it was an x collision or a y collision like thisOk so if you want something to collide with an object preventing it from moving past it, im assuming you want it to collide with a form of immovable wall, just make it so every time the sprite moves it checks to see if it is touching the object, and if so then you move with the opposite, example: I just need more examples of Collision with:define Block namechange x by (x velocity)I hope this helps!
change y by (y velocity)
if <touching [wall sprite v] ?> then
change x by ((-1) * (x velocity))
change y by ((-1) * (y velocity))
end
change x by (x velocity)
change y by (y velocity)
if <touching [wall sprite v] ?> then
change x by ((-1) * (x velocity))
if <touching [wall sprite v] ?> then
change x by (x velocity)
change y by ((-1) * (y velocity))
if <touching [wall sprite v] ?> then
change x by ((-1) * (x velocity))
else
stop [this script v]
else
stop [this script v]
end
Hi
Trying to become a forum helper
- TheRealRldFan
- Scratcher
36 posts
Collision
https://scratch.mit.edu/projects/989406212/something like this?
if <yeah> then
end
Last edited by TheRealRldFan (March 25, 2024 19:23:43)
- TheRealRldFan
- Scratcher
36 posts
Collision
like you can use the following:
(Previous Y)
(Previous X)
(X)
(Y)
define Collision (X) (Y)
- Shrek_em
- Scratcher
34 posts
Collision
If every wall is going to be the same color (could just be an outline) then the easiest solution is probably
And just copy-paste that if then code for every player input, change the “touching color” to whatever color the thing its colliding with is, and swap out the “change y by” code for “change x by” if it is going horizontal, also make sure to match the “-1” with the speed of the character and remove the “-” if It is going down or left
I think this works idk I'm not sure but if I remember correctly this should work
when green flag clicked
forever
if <<key [w v] pressed?> and <touching color [#23a59c] ?>> then
change y by (-1)
And just copy-paste that if then code for every player input, change the “touching color” to whatever color the thing its colliding with is, and swap out the “change y by” code for “change x by” if it is going horizontal, also make sure to match the “-1” with the speed of the character and remove the “-” if It is going down or left
I think this works idk I'm not sure but if I remember correctly this should work
Shrek_em
Really bad coder
Really good ideas
Want to make a signature?
Click this purple thing to figure out how
- TheRealRldFan
- Scratcher
36 posts
Collision
thanks If every wall is going to be the same color (could just be an outline) then the easiest solution is probablywhen green flag clicked
forever
if <<key [w v] pressed?> and <touching color [#23a59c] ?>> then
change y by (-1)
And just copy-paste that if then code for every player input, change the “touching color” to whatever color the thing its colliding with is, and swap out the “change y by” code for “change x by” if it is going horizontal, also make sure to match the “-1” with the speed of the character and remove the “-” if It is going down or left
I think this works idk I'm not sure but if I remember correctly this should work
- Shrek_em
- Scratcher
34 posts
Collision
thanks If every wall is going to be the same color (could just be an outline) then the easiest solution is probablywhen green flag clicked
forever
if <<key [w v] pressed?> and <touching color [#23a59c] ?>> then
change y by (-1)
And just copy-paste that if then code for every player input, change the “touching color” to whatever color the thing its colliding with is, and swap out the “change y by” code for “change x by” if it is going horizontal, also make sure to match the “-1” with the speed of the character and remove the “-” if It is going down or left
I think this works idk I'm not sure but if I remember correctly this should work
no problem!
Shrek_em
Really bad coder
Really good ideas
Want to make a signature?
Click this purple thing to figure out how
- TheRealRldFan
- Scratcher
36 posts
Collision
I am going to follow thanks for the tip!thanks If every wall is going to be the same color (could just be an outline) then the easiest solution is probablywhen green flag clicked
forever
if <<key [w v] pressed?> and <touching color [#23a59c] ?>> then
change y by (-1)
And just copy-paste that if then code for every player input, change the “touching color” to whatever color the thing its colliding with is, and swap out the “change y by” code for “change x by” if it is going horizontal, also make sure to match the “-1” with the speed of the character and remove the “-” if It is going down or left
I think this works idk I'm not sure but if I remember correctly this should work
no problem!