Discuss Scratch

cmyrland
Scratcher
6 posts

How can I make the sprites collide?

Hi..

I am trying to make my sprites collide in my little game http://scratch.mit.edu/projects/14324137/ .. I'm still just learning the basics here, and thought that this game might serve as a tutorial for my students in the future.

But my big issue is: I cannot get the sprites to be on the same layer in the game! Either the cat is in front, or the apple is in front. I've made a script for the apple to disappear when they collide, but I can't seem to trigger it. Can somebody take a look at my code and tell me what I'm doing wrong?
cmyrland
Scratcher
6 posts

How can I make the sprites collide?

Nevermind. Fixed it! I forgot to add the “forever” control block to the apple's script.
k9lego
Scratcher
1000+ posts

How can I make the sprites collide?

Here, try this:
Put this in the Cat. (Player)
whenclickedforeverwaituntiltouchingApple?iftouchingApple?thenbroadcastApple Disappear


Put this in the Apple
whenIreceiveApple Disappearhide
k9lego

Last edited by k9lego (Nov. 23, 2013 16:15:36)

Photoguy77
Scratcher
100+ posts

How can I make the sprites collide?

Unfortunately, this is not possible. Are there any other questions that you have abut the project?
cmyrland
Scratcher
6 posts

How can I make the sprites collide?

k9lego wrote:

Here, try this:
Put this in the Cat. (Player)
whenclickedforeverwaituntiltouchingApple?iftouchingApple?thenbroadcastApple Disappear


Put this in the Apple
whenIreceiveApple Disappearhide
k9lego


Kthx. I just added a forever-loop to my hide-script for my apple. Does it matter if I do it my way or yours? Any pros/cons?
Photoguy77
Scratcher
100+ posts

How can I make the sprites collide?

What way is yours? I may be able to help you determine which way to use.
cmyrland
Scratcher
6 posts

How can I make the sprites collide?

Photoguy77 wrote:

Unfortunately, this is not possible. Are there any other questions that you have abut the project?

It's all good now. Appears the layers-thing was a dead end.
cmyrland
Scratcher
6 posts

How can I make the sprites collide?

Photoguy77 wrote:

What way is yours? I may be able to help you determine which way to use.

See my project page. I put the full hide-script on the apple. K9love's.. well, see above.
epicks
Scratcher
1 post

How can I make the sprites collide?

im wanting to collide withe objects like in a platformer
deck26
Scratcher
1000+ posts

How can I make the sprites collide?

epicks wrote:

im wanting to collide withe objects like in a platformer
Please create your own new topic rather than necroposting.
bluepinkturquoise
New Scratcher
1 post

How can I make the sprites collide?

I need to know how to collide sprites and when I do collide them I want that to change the backdrop
Username321go
Scratcher
2 posts

How can I make the sprites collide?

whenclicked
jimbobgob
Scratcher
1 post

How can I make the sprites collide?

guys is 2022
gaming

Powered by DjangoBB