Posted By: DonaldThief
"effect_sprite()" causes engine crash - 08/10/13 17:49
I made a glass sprite entity, then attached the action "glass_action1" to it. After that, I wanted to make some glass breaking effect when the enemy shoots the glass (using "c_trace" weapon)......
I use "effect_sprite()" function to make the broken glass pieces ,but the engine crashes. Even I used "effect_sprite()" in many other small projects and the same problem occurs, the engine crashes
Here's my code (glass sprite is attached to "glass_action1"):
ThanQ for reading
I use "effect_sprite()" function to make the broken glass pieces ,but the engine crashes. Even I used "effect_sprite()" in many other small projects and the same problem occurs, the engine crashes
Here's my code (glass sprite is attached to "glass_action1"):
Code:
#include <particles.c>
function glass_broken(PARTICLE* glassy)
{
vec_add(glassy.vel_x,vector(random(5)-2.5,random(5)-2.5,random(5)-2.5));
vec_set(glassy.blue,vector(random(255),random(255),255));
set(glassy, MOVE | BRIGHT | TRANSLUCENT);
glassy.alpha = 100;
glassy.size = 16-random(12);
glassy.gravity = 0.2;
glassy.alpha = 50;
glassy.lifespan = 16;
glassy.event = NULL;
}
function glass_shot()
{
if(event_type == EVENT_SHOOT && (mouse_left) && (player_shooting) && (ammo[current_weapon] > 0) && (player_health > 0))
{
effect_sprite("glass_piece1.tga",glass_broken,20,my.x,nullvector);
wait(1);
ent_remove(my);
}
}
action glass_action1()
{
my.pan += 360;
set(my,POLYGON);
my.emask |= ENABLE_SHOOT;
my.event = glass_shot;
if(is(my,TRANSLUCENT) == 0) set(my,TRANSLUCENT);
my.alpha = 50;
}
ThanQ for reading
