I have started a fairly basic game in lite-c but
run into a problem I don't think makes any sence.
I ran the code below and the second I reached the game screen it said "too many functions"
what the hell do I do?
here is my code:
////////////////////////////////////////////////////////////////
ENTITY* space;
////////////////////////////////////////////////////////////////
ENTITY* ship;
////////////////////////////////////////////////////////////////
ENTITY* laser;
////////////////////////////////////////////////////////////////
ENTITY* rock;
////////////////////////////////////////////////////////////////
ENTITY* frag;
////////////////////////////////////////////////////////////////
ENTITY* boulder;
////////////////////////////////////////////////////////////////
ENTITY* junk;
////////////////////////////////////////////////////////////////
var ynum = 30;
var znum = -18;
function trigger_event()
{
if (event_type == EVENT_PUSH)
{
ent_remove(me);
}
}
action frag_one()
{
frag = my;
while (1)
{
c_move (my, vector(0*time_step, -15, 0), nullvector, GLIDE); // move the fragment left
}
}
action laser_fire()
{
var fire_percentage = 1;
laser = my;
my.emask = (ENABLE_IMPACT);
my.tilt = 90;
my.ambient = 100;
while (1)
{
c_move (my, vector(0*time_step, 0, -3), nullvector, GLIDE); //move the laser
ent_animate(my,"fly",fire_percentage, ANM_CYCLE);
fire_percentage += 1;
wait (1);
}
}
function remove_asteroid()
{
var boom_percent = 0;
if(event_type == EVENT_IMPACT)
{
wait (1);
ent_remove(me);
ent_remove(laser);
}
}
action asteroid()
{
ent_create("laser.mdl", vector (26000, 0, 0), laser_fire);
rock = me;
c_setminmax(me);
while (1)
{
c_move (my, vector(-25*time_step, 0, 0), nullvector, GLIDE); // move the fragment left
wait (1);
my.emask = (ENABLE_IMPACT); // make entity sensitive for block and entity collision
my.event = remove_asteroid;
}
}
function remove_asteroidbig ()
{
if(event_type == EVENT_IMPACT)
{
wait (1);
ent_remove (me);
ent_remove (laser);
}
}
action junk ()
{
junk = me;
while (1)
{
c_move (my, vector(-28*time_step, 0, 0), nullvector, GLIDE); // move the fragment left
wait (1);
my.emask = (ENABLE_IMPACT); // make entity sensitive for block and entity collision
my.event = remove_asteroidbig;
}
}
action shoot()
{
ent_create("laser.mdl", vector (185, ynum, znum), laser_fire);
wait (1);
}
function remove_ship()
{
ent_remove (me);
}
action ship_functions()
{
var walk_percentage = 0;
var fly_percentage = 1;
ship = me;
my.ambient = 10;
my.pan = 180;
c_setminmax(me);
my.emask = (ENABLE_IMPACT); // make entity sensitive for block and entity collision
while (1)
{
if (key_cul)
{
c_move (my, vector(0*time_step, -1, 0), nullvector, GLIDE); // move the ship left
walk_percentage -= 0.5;
ynum += 1;
}
if (key_cur)
{
c_move (my, vector(0*time_step, 1, 0), nullvector, GLIDE); //move the ship right
walk_percentage += 0.5;
ynum -= 1;
}
if (key_cuu)
{
c_move (my, vector(0*time_step, 0, 1), nullvector, GLIDE); //move the ship up
walk_percentage += 0.5;
znum += 1;
}
if (key_cud)
{
c_move (my, vector(0*time_step, 0, -1), nullvector, GLIDE); //move the ship down
walk_percentage -= 0.5;
znum -= 1;
}
on_space = shoot;
ent_animate(my,"fly",fly_percentage, ANM_CYCLE);
fly_percentage += 3 * time_step;
my.event = remove_ship;
wait (1);
}
}
function main ()
{
level_load ("");
ent_create("space_bg.mdl", vector (10000, 50, 20), NULL); //create bg
ent_create("starship Hunter.mdl", vector (0, 50, 0), ship_functions); //create ship
ent_create("asteroid.mdl", vector (1850, -250, 45), asteroid); //create asteroid
ent_create("space junk frag.mdl", vector (2221, 250, 95), asteroid); //create space junk piece
ent_create("space junk.mdl", vector (2221, 250, 95), junk); //create space junk
vec_set(camera.x, vector (-600, 0, 100)); // set a proper camera position
}