Discuss Scratch

num31
Scratcher
11 posts

Bug with shared enemy ID

In my game, I used WarFame's code for a bloons like game. But when the clone makes a copy of itself, both ID's are actually shared so when one dies the other freezes in place. The enemy X and Y values stay the same, undeleted.
https://scratch.mit.edu/projects/986039912/
(sorry, its kinda messy)
MrKingofScratch
Scratcher
100+ posts

Bug with shared enemy ID

Make sure that you set the clone that's copying itself's clone id back to the origional before you run any more code using it.
Also make sure that the clone ID variable is for this sprite only.

code that runs using clone ID (moving clone, setting health, ETC)
set [oldCloneID v] to [cloneID]//make sure that this copying script is in the same loop as the code that uses the ID
set [cloneID v] to [new id]
create clone of [myself v]
set [cloneID v] to (oldCloneID)

Last edited by MrKingofScratch (March 30, 2024 20:42:34)


Last edited by kaj (Tomorrow 00:00:00)
100th post!

Powered by DjangoBB