Discuss Scratch

ACanadienCapybara
Scratcher
20 posts

I need help with this project

How do I make the enemies dissapear when player hits them with sword?
https://scratch.mit.edu/projects/990958914/editor
Thanks
Pixilized
Scratcher
100+ posts

I need help with this project

ACanadienCapybara wrote:

How do I make the enemies dissapear when player hits them with sword?
https://scratch.mit.edu/projects/990958914/editor
Thanks
You have the code to do this in your project. Is the code not working? (I can’t tell, I’m on mobile)
ACanadienCapybara
Scratcher
20 posts

I need help with this project

it is not
ABelly99
Scratcher
43 posts

I need help with this project

When an enemy notices it gets hit by the sword, hide or delete the clone.

when I start as a clone
forever
if <touching [Sword v] ?> then
delete this clone
end
end

Last edited by ABelly99 (April 5, 2024 20:46:03)

callmehNOOB123
Scratcher
100+ posts

I need help with this project

ACanadienCapybara wrote:

it is not

In your project, you already have the scripts, I'm not sure why it isn't working though.
callmehNOOB123
Scratcher
100+ posts

I need help with this project

ABelly99 wrote:

You could make them disappear by broadcasting a message and then hiding them.
when player kills enemy
broadcast [Kill Enemy v]

when I receive [Kill Enemy v]
hide

But they're clones, you also need to delete them, and he already has these scripts inside his project. His script detects if the enemy is touching the sword or not.
ABelly99
Scratcher
43 posts

I need help with this project

Agreed, I fixed it.
ACanadienCapybara
Scratcher
20 posts

I need help with this project

i did this, and the enemies are clones
when I start as a clone
glide () secs to x: (0) y: (0)
forever
if <touching [ ] ?> then
delete this clone
end
end
ACanadienCapybara
Scratcher
20 posts

I need help with this project

still not working
ABelly99
Scratcher
43 posts

I need help with this project

ACanadienCapybara wrote:

i did this, and the enemies are clones
when I start as a clone
glide () secs to x: (0) y: (0)
forever
if <touching [ ] ?> then
delete this clone
end
end[/quote]
Ya, that works great too!

Last edited by ABelly99 (April 5, 2024 20:47:54)

ABelly99
Scratcher
43 posts

I need help with this project

ACanadienCapybara wrote:

still not working
Make sure to hide the clone.
That should work…
Edit:
Actually, I cannot get it to work.
Just give me some time, I will get it.

Last edited by ABelly99 (April 5, 2024 20:56:11)

ACanadienCapybara
Scratcher
20 posts

I need help with this project

nothing happens when clone touches sword
ABelly99
Scratcher
43 posts

I need help with this project

I found the solution.
I think the sword's hit box is wrong.

In the sword sprite, were the:
when I start as a clone
block is, put a if touching enemy broadcast kill enemy.
This should work if you get a
when I receive [Kill Enemy v]
hide
In the enemy sprite
See if that works…

Last edited by ABelly99 (April 5, 2024 21:12:39)

ACanadienCapybara
Scratcher
20 posts

I need help with this project

still not working
ACanadienCapybara
Scratcher
20 posts

I need help with this project

and also it has to do with clones not with the actual sprite
SpyCoderX
Scratcher
1000+ posts

I need help with this project

Is the problem that the sword is only defeating enemies when the enemies stop moving?
ACanadienCapybara
Scratcher
20 posts

I need help with this project

no, the sword does not defeat the enemy at all
Qweffor
Scratcher
80 posts

I need help with this project

ACanadienCapybara wrote:

How do I make the enemies dissapear when player hits them with sword?
https://scratch.mit.edu/projects/990958914/editor
Thanks
Right now, it looks like the enemies only disappear when it touches the player. I see you also want them to die when they touch the sword.
There are 2 fairly easy solutions:
1. Make a separate sword sprite and have the enemies die when they touch or
2. Make a variable called “swinging” and set it to one when the player swings. If an enemy touches the player while “swinging” is one, then it dies and does not remove hp. Make sure to set “swinging” to 0 after the animation is done.
ACanadienCapybara
Scratcher
20 posts

I need help with this project

I already have a separate sword sprite
MineTurte
Scratcher
1000+ posts

I need help with this project

ACanadienCapybara wrote:

I already have a separate sword sprite
Sorry if this isn't too helpful but I'm too lazy to look through code rn so maybe you could give me an insight on what exactly is wrong? I can provide help from there

Update: I'm smarter than all of you (joke) >:) I found the problem. It's the glide code. It waits until it's done to run the code after it.

here's an fix example: https://scratch.mit.edu/projects/996348393/

19 Replies and not a single person could figure out why lol. Cmon y'all

Last edited by MineTurte (April 6, 2024 13:31:25)

Powered by DjangoBB