Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » My enemies are invincible, why?
- Cub56
-
1000+ posts
My enemies are invincible, why?
In this game
https://scratch.mit.edu/projects/111769650/
IF you go to the top-left island, down into the dungeon the enemies in the dungeon are invincible, anyone know why? I really don't know what's wrong.
Does anyone know why? Please help, I've been stuck on this for ages. Thanks, will give credit.
https://scratch.mit.edu/projects/111769650/
IF you go to the top-left island, down into the dungeon the enemies in the dungeon are invincible, anyone know why? I really don't know what's wrong.
Does anyone know why? Please help, I've been stuck on this for ages. Thanks, will give credit.
Last edited by Cub56 (June 3, 2016 09:08:40)
- Cub56
-
1000+ posts
My enemies are invincible, why?
Bump. Sorry it wasn't shared, I shared the wrong project.
It's replaced with the right link now
It's replaced with the right link now
- deck26
-
1000+ posts
My enemies are invincible, why?
It's always a good idea to take a project like this (170 scripts and 51 sprites) and see if you can replicate the problem in a simpler copy. Take a copy of the project and get rid of any sprites and scripts that don't affect the area of the problem. Combine scripts and go through your code looking for ways of simplifying, combining forever loops etc. Keep testing as you reduce the project more and more. Quite often either the problem will suddenly become obvious or disappear. Even if it doesn't you've made it much easier for others to help.
- Cub56
-
1000+ posts
My enemies are invincible, why?
I would, but this game is supposed to be a big open-world action adventure with loads of stuff in it, and if projects glitch with more sprites/scripts, how do games like Griffpatch's 2D Paper Minecraft with 731 assets not glitch to the point of unplayability?
- deck26
-
1000+ posts
My enemies are invincible, why?
731 assets not glitch to the point of unplayability?I'm only suggesting cutting down the copy to find this bug. You then fix the bug in the main copy and carry on. I would, but this game is supposed to be a big open-world action adventure with loads of stuff in it, and if projects glitch with more sprites/scripts, how do games like Griffpatch's 2D Paper Minecraft with
However from a quick look you should reduce your use of green flag scripts and forever loops (reduce the work these are doing).
For example, in Home Island rather than the forever loop you have do
Although you may think your script doesn't do much work Scratch still thinks it has to move and show the sprite every time you go through the loop with that background. Do that in enough sprites and you're slowing things down.
- Cub56
-
1000+ posts
My enemies are invincible, why?
Thanks, will try that. This is a version with reduced sprites
https://scratch.mit.edu/projects/112426531/
The crabs and skeletons (islands on right) are not invincible, but the enemies in the dungeon (top left island) are still invincible
EDIT: I've shrunk it down as much as possible and used your Home Island script (thanks, already credited) but the dungeon enemies are still invincible
https://scratch.mit.edu/projects/112426531/
The crabs and skeletons (islands on right) are not invincible, but the enemies in the dungeon (top left island) are still invincible
EDIT: I've shrunk it down as much as possible and used your Home Island script (thanks, already credited) but the dungeon enemies are still invincible
Last edited by Cub56 (June 3, 2016 10:35:12)
- drmcw
-
1000+ posts
My enemies are invincible, why?
It doesn't help that the sword is just another costume for the player sprite, so the monster damages you for touching the sword. Since you use touching colour to detect a sword hit then your colour selection is most likely out. As already said, your use of forever loops is bad, why does the wait until touching colour need one? Sureluy once it's dead it's dead? But especially things like
Why? (and no don't try and answer that! ;-) )
- Cub56
-
1000+ posts
My enemies are invincible, why?
No, you hit, back away before they hit you, move back, hit and repeat.
If the monster damages you you stayed there too long. Like in Minecraft, you hit the mob, back away, and repeat, if you just stand there in front of the zombie he'll hit you over and over.
If the monster damages you you stayed there too long. Like in Minecraft, you hit the mob, back away, and repeat, if you just stand there in front of the zombie he'll hit you over and over.
- drmcw
-
1000+ posts
My enemies are invincible, why?
the enemies in the dungeon are invincible, anyone know why?
- deck26
-
1000+ posts
My enemies are invincible, why?
Still too many scripts and sprites for me to contemplating spending much time on. Why not reduce to crab island (not invincible) and dungeon island (invincible). Get rid of as much of the rest as you can - eg a simple key press to switch between those two island allows you to get rid of all the code that switches between the islands. The health bar is probably irrelevant, same for the shop etc etc.
It's easier for you to do that since you know your project but it makes it much much easier to follow the code and try to help.
It's easier for you to do that since you know your project but it makes it much much easier to follow the code and try to help.
- Cub56
-
1000+ posts
My enemies are invincible, why?
Think it was a bug with the colours, on my computer none of them are invincible now, credited you both, thanks very much! 
On my computer they seem fine, if they are still invincible on your computer(?) will try reducing.
This is the one with the (fixed?) mobs
https://scratch.mit.edu/projects/112426531/

On my computer they seem fine, if they are still invincible on your computer(?) will try reducing.
This is the one with the (fixed?) mobs
https://scratch.mit.edu/projects/112426531/
Last edited by Cub56 (June 3, 2016 13:09:35)
- drmcw
-
1000+ posts
My enemies are invincible, why?
Think it was a bug with the colours, on my computer none of them are invincible now
That's what I meant with “you use touching colour to detect a sword hit then your colour selection is most likely out”

The rest was just criticism!

- Cub56
-
1000+ posts
My enemies are invincible, why?
Thanks for the help.
As I said, you hit, back away quickly, and repeat. There's a 0.6 second delay because if you get rid of the delay you can one-shot the monster, and if you stay next to the monster for more than 0.4 seconds you get damaged, so you have to hit and back away before the monster can hit (0.4 secs) if you don't want to get hit in return.

- Discussion Forums
- » Help with Scripts
-
» My enemies are invincible, why?