Posted By: rtsgamer706
movement making collisions crash - 03/01/14 23:22
Hi, I started programming an enemy into my game. I got it to die when it collides with a laser without any problems. Oddly, once I told the enemy to start moving forwards the game would crash whenever it collided with a laser. No error message or anything, the game just closes.
Here are the actions for the laser and the enemy:
If I remove the movement command in the enemy it dies fine again. I'm really lost as to why this is
thanks for the help
Here are the actions for the laser and the enemy:
Code:
function delete_anim() { var destroy_percent = 0; while (my) { destroy_percent += 6; ent_animate(my,"deleting", destroy_percent, 0); if (destroy_percent >= 100) ent_remove(me); wait(1); } } function delete() { if (event_type == EVENT_IMPACT || event_type == EVENT_ENTITY) { wait(1); ent_remove(you); ent_morph(me, "goomba_death.mdl"); delete_anim(); } } action enemy() { c_setminmax(me); my.emask |= (ENABLE_IMPACT | ENABLE_ENTITY); my.event = delete; var temp; var walk_percent; while (my) { vec_set (temp, ship.x); vec_sub (temp, my.x); vec_to_angle(my.pan, temp); my.tilt = 0; walk_percent += 2; ent_animate(my,"step", walk_percent, ANM_CYCLE); c_move (me, vector(15*time_step, 0, 0), nullvector, GLIDE | IGNORE_PASSABLE); wait(1); } } action beam() { c_setminmax(me); vec_for_vertex(my.x, ship, 3); my.pan = delete_ship.pan; var laser_lifetime = 200; while (my) { c_move (me, vector(45*time_step, 0, 0), nullvector, GLIDE | IGNORE_PASSABLE); laser_lifetime--; if (laser_lifetime <= 0) ent_remove(me); wait(1); } }
If I remove the movement command in the enemy it dies fine again. I'm really lost as to why this is
thanks for the help