|
Post by kempston on Dec 24, 2019 13:39:20 GMT
Hello ! First of all: Merry Christmas to everyone ! I'm working on a little game using AGD version 4.7 and would like to kill several enemy sprites at the same time when the player executes a certain action. Any suggestions ? Thank you very much in advance.
|
|
|
Post by lamptonworm on Dec 28, 2019 15:15:38 GMT
Hi,
Merry Christmas!
Just an idea, have a global variable for example K, and in each sprite type have something like..
IF K = 1 REMOVE ENDIF
Then set K to 1 when your player has performed the action.
Cheers, LW.
|
|
|
Post by kempston on Dec 28, 2019 17:10:18 GMT
Hello ! Thank you very much for your tip, I did think the same two days ago It works but with some issues I have to figure out why. Just by adding this to only one enemy sprite type, all enemies are destroyed (even the ones that shouldn't) and it skips to the next level. I'll keep trying.
|
|
|
Post by kempston on Jan 4, 2020 10:03:37 GMT
In player event:
IF KEY 6 LET H = 1 ENDIF
In all enemy events:
IF H = 1 IF G > 0 EXPLODE 8 REMOVE SCORE 100 LET H = 0 BEEP 30 SPAWN 2 2 ENDIF ENDIF
G counts a limited no. of times the player may use this feature of destroying all enemies at once.
When the event is triggered, the program kills and respawns enemies many times instantly. Any suggestion to control this ?
Thanks !
|
|
|
Post by lamptonworm on Jan 5, 2020 15:11:20 GMT
Hi,
It's a little hard to guess what is happening but I'll have a go - might be that key 6 is repeating, you may want to only do the bomb when you release/re-press key 6. Something like this...
Player:
IF KEY 6 IF H = 0 LET H = 1 ENDIF ELSE LET H = 0 ENDIF
Enemy:
IF H = 1 REMOVE LET H = 2 ENDIF
Cheers, LW.
|
|
|
Post by kempston on Jan 18, 2020 12:56:20 GMT
Thank you very much for your hint lamptonworm :-)
In the end I've decided to go the easiest way and use the RESTART procedure.
Player event stays the same. Enemies' events also but for one. In this one I add RESTART:
IF H = 1 REMOVE EXPLODE 8 LET H = 0 RESTART ENDIF
And it works.
|
|
|
Post by lamptonworm on Jan 18, 2020 16:08:49 GMT
glad you got it working
|
|
|
Post by kempston on Jan 18, 2020 20:41:23 GMT
Thank you !!!
|
|