Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
2 registered members (Quad, AndrewAMD), 1,007 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
too many functions?! #305675
01/16/10 13:47
01/16/10 13:47
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
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
}

Re: too many functions?! [Re: rtsgamer706] #305682
01/16/10 14:21
01/16/10 14:21
Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
GorNaKosh Offline
Junior Member
GorNaKosh  Offline
Junior Member

Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
in your action frag_one() I would add a wait(1);

Re: too many functions?! [Re: GorNaKosh] #305683
01/16/10 14:25
01/16/10 14:25
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
thanks but that didn't change a thing.
I don't even activate that action in the code.
Any other suggestions?

Re: too many functions?! [Re: rtsgamer706] #305684
01/16/10 14:43
01/16/10 14:43
Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
GorNaKosh Offline
Junior Member
GorNaKosh  Offline
Junior Member

Joined: Feb 2009
Posts: 84
Deutschland/Niedersachsen
I've tested your code and found out that your global entity-pointer and the one action both named as "junk" ... thats the problem wink

Last edited by GorNaKosh; 01/16/10 14:44.
Re: too many functions?! [Re: GorNaKosh] #305697
01/16/10 16:51
01/16/10 16:51
Joined: Dec 2009
Posts: 361
R
rtsgamer706 Offline OP
Senior Member
rtsgamer706  Offline OP
Senior Member
R

Joined: Dec 2009
Posts: 361
Yep, that solved my problem thanks a ton I hope I can answer
some of your questions in the future and feel free to use the
code I gave you earlier for anything you'd like.
Thanks for all the help
rtsgamer


Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1