Discuss Scratch

Tesla0511
Scratcher
22 posts

How to make a Glide Collision

Can you tell me how to make a Glide Collision

I'm Working on a game called “Nextbot Creator” and I'm I'm having some minor issues

The one who helped me deserve a follow

deck26
Scratcher
1000+ posts

How to make a Glide Collision

Generally it is better to use a loop for movement if you want to detect collisions. Otherwise the collision has to be detected by a separate script since while the glide block is running the script that contains it will not be doing anything else.
Tesla0511
Scratcher
22 posts

How to make a Glide Collision

That was a bit not helpful, but thanks, you deserve a follow
skeletonsteveplays
Scratcher
100+ posts

How to make a Glide Collision

So, what do you mean by a glide collision?

Last edited by skeletonsteveplays (Aug. 18, 2022 23:54:50)

Tesla0511
Scratcher
22 posts

How to make a Glide Collision

ok

collision is something you bounce on another sprite

Last edited by Tesla0511 (Aug. 19, 2022 01:01:47)

RT_Borg
Scratcher
1000+ posts

How to make a Glide Collision

Hi Tesla0511,

I think we're having trouble answering because of the term “Glide Collision”. That sounds like you're using the “glide” block:
glidesecstox:0y:0

as deck26 pointed out, once a script calls the glide block, it performs the glide over however many secs. If your sprite were to collide with some other object while it is gliding, another script could detect “touching”, but it's difficult to do much about it. (Your only option to stop in the middle of a glide is
stopother scripts in sprite

That might be acceptable if you actually want to stop when sprites touch (and have no other scripts in the sprite that need to keep running.) But you said

collision is something you bounce on another sprite

If you need to bounce, you probably need to adjust your movement to use something other than glide (move blocks or change x by, change y by).

If you share the project and post a link, you may get suggestions on how to adjust your movement code to work with collisions.

– RT_Borg
mineguy9
Scratcher
30 posts

How to make a Glide Collision

If you want to move something you can do

whenIreceivemoverepeatuntiltouching?changexby5iftouching?thenstopthis scriptwhenclickedforeveriftouching?thenchangexby-5else




Last edited by mineguy9 (Aug. 19, 2022 02:25:11)

Tesla0511
Scratcher
22 posts

How to make a Glide Collision

sorry i cant use it
i meant using glide block but its ok
that was pretty helpful
mineguy9
Scratcher
30 posts

How to make a Glide Collision

The problem with glide block is there is not a good way to stop it, like RT_Borg said
If your sprite were to collide with some other object while it is gliding, another script could detect “touching”, but it's difficult to do much about it. (Your only option to stop in the middle of a glide is
stopother scripts in sprite

So using the “repeat until touching” script is probably the closest to being able to have something “glide” and still being able to stop it.

Last edited by mineguy9 (Aug. 19, 2022 03:37:08)

snowberis
Scratcher
81 posts

How to make a Glide Collision

mineguy9 wrote:

The problem with glide block is there is not a good way to stop it, like RT_Borg said
If your sprite were to collide with some other object while it is gliding, another script could detect “touching”, but it's difficult to do much about it. (Your only option to stop in the middle of a glide is
stopother scripts in sprite

So using the “repeat until touching” script is probably the closest to being able to have something “glide” and still being able to stop it.

I agree, I believe the glide block lags when it glides so collision scripts could possibly stop working.
However, if you do insist on using the glide method,
setGlideStartXtoxpositionsetGlideStartYtoypositionglidesecstox:y:

whenclickedforeverwaituntiltouchinglevel?stopother scripts in spritebroadcastcollidedandwait

whenIreceivecollidedrepeatuntilnottouchinglevel?ifxposition<GlideStartXthenchangexby1elsechangexby-1

whenIreceivecollidedrepeatuntilnottouchinglevel?ifyposition<GlideStartYthenchangeyby1elsechangeyby-1

Note: with this method, you won’t be able to get to the edge of a wall, but it works.

Last edited by snowberis (Aug. 19, 2022 13:09:24)

Powered by DjangoBB