Discuss Scratch

Binhsuperstar
Scratcher
1 post

Clone problem in my 2D shooter

Hi, I'm Binhsuperstar, and I'm from Vietnam.
In my 2D shooter game, I don't know why I ordered Ghost clones to appear and move downwards but they wouldn't even show themselves. Same thing with the bullets.
The project's link is https://scratch.mit.edu/projects/846531695.

I was recycling the same script in a game I coded 1 year ago. This game's link: https://scratch.mit.edu/projects/620230835
BULLET PROBLEM
The coding, for instance:
In “Scratch” character
when [space] key pressed
bắn

define bắn
go to front
create clone of [Bullet]
wait (0.5) secs

In “Bullet” character
when green flag clicked
hide

when I start as a clone
go to [Scratch]
repeat until <touching [edge] ?>
change y by (1)
end
delete this clone


GHOST PROBLEM
In “Ghost” character
when I receive [Start Game]
hide
forever
wait (1) secs
create clone of [myself]
end


when I start as a clone
show
go to x: (pick random (-220) to (220)) y: (180)
repeat until <touching [edge] ?>
change y by (1)
end
delete this clone
The game supports 3 languages: Vietnamese, English and French. (I started to learn French when I was in 1st grade.)
Also this is part of my SUPER IMPORTANT end-schoolyear homework so if no one answered me how to fix this problem within 6 days, I'll be DOOMED!

Last edited by Binhsuperstar (May 13, 2023 14:44:48)

snezitko
Scratcher
100+ posts

Clone problem in my 2D shooter

maybe the problem is with that you made these clones to have the
set [ghost v] effect to (100)
that will make the sprite completly invisible

or some of your conditions on the repeat untitl block are met the first time creating the clone which will make it end the loop and delete that clone:
when I start as a clone
go to x: (100) y: (0)
repeat until <(x position) > [80]>
move (10) steps
end
delete this clone
or you just forgot some code that makes the clone immediatly disapear like this:

when I start as a clone
delete this clone

Last edited by snezitko (May 13, 2023 14:48:36)

Adithya_7
Scratcher
40 posts

Clone problem in my 2D shooter

Hi @Binhsuperstar,

For your bullet problem, you need to add a show block below when i start as a clone event

when I start as a clone
go to [Scratch]
show
repeat until <touching [edge] ?>
change y by (1)
end
delete this clone

For your ghost problem, it would be better if you explained what the problem is.
medians
Scratcher
1000+ posts

Clone problem in my 2D shooter

Are you looking for assistance in the first project linked, or the second one?
If it's the first one, I don't see the code in the project.
Edit: Also, you can get the backdrop name by using the block in looks instead of having to use the sensing block:
(backdrop name)
Edit 2:
This is what I see in the ghost sprite:

I don't see a bullet sprite.
And the Scratch Cat sprite also has no code.

Last edited by medians (May 14, 2023 00:29:17)

Powered by DjangoBB