Sorry, I needed sleep
I've uploaded the 'bad' version to
http://fefson.be/spel/error/
Sometimes it goes wrong after the first shot, sometimes it takes up to 5 shots...
There's also a version that works fine without particles at
http://fefson.be/spel/
The code for the collision event that checks the collision between bullet and 'enemy is:
Code:
a = (instance_nearest(x, y, obj_enemy));
if (a.textopenemy == global.uitkomst){
if (global.aantalOeftespelen<=1){
room_goto(rm_klaar);
exit;}
global.aantalOeftespelen=global.aantalOeftespelen-1;
with (instance_nearest(x, y, obj_enemy))
{ instance_destroy();
}
room_restart();
exit;};
if (a.textopenemy != global.uitkomst){
room_goto(rm_fout); exit;};
with (instance_nearest(x, y, obj_enemy))
{ instance_destroy();
}
Where 'textopenemy' is the number on the enemies and 'global.uitkomst' is the correct answer. If they match, the room restarts and the number of rounds to be played is decreased by 1. If they don't match, you're send to room 'rm_fout', which dispolays the correct answer.
When the bullet gets created, I also have an
instance_create_layer(x,y,"lay_particles",obj_bulletparticles);
Which only has a step-evetn with the code
Code:
x = obj_bullet.x;
y = obj_bullet.y;
effect_create_below(ef_star, x , y, choose(0, 1, 2), c_yellow);