0 registered members (),
1,227
guests, and 2
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
the entity doesnt appear on the game when we press space bar.
#350281
12/15/10 04:27
12/15/10 04:27
|
Joined: Dec 2009
Posts: 24
DirtyDhan
OP
Newbie
|
OP
Newbie
Joined: Dec 2009
Posts: 24
|
..the entity must appear when we press space bar..
function main() { screen_size.x = 800; screen_size.y = 600; screen_color.blue = 150; level_load(""); //ent_create ("2.mdl", vector (1000, 50, -40), NULL); }
function none() { my.ambient = 50; my.lightrange = 300; vec_set(my.blue,vector(255,50,50)); set(me,BRIGHT);
vec_scale(my.scale_x,0.15); my.STATE = 1; }
function go() { my.STATE = 1; while (1) { if(my.STATE == 1) { if(key_space) my.STATE = 2; } if(my.STATE==2) { ent_createlocal("2.mdl",vector(1000,50,-40), none); my.STATE = 3; } if (my.STATE == 3) { if (!key_space) my.STATE = 1; } wait(1); } }
..if you will able to reply i will appreciate your effort.. ..thanks..
If you do not know where you are . . . Ask a villager.
|
|
|
Re: the entity doesnt appear on the game when we press space bar.
[Re: 3dgs_snake]
#350321
12/15/10 13:15
12/15/10 13:15
|
Joined: Jul 2008
Posts: 1,178 England
MrGuest
Serious User
|
Serious User
Joined: Jul 2008
Posts: 1,178
England
|
Hi,
Do you want to create entity when you hit space bar or do you want to show it? In your code, you have 2 functions that use the "my" pointer, you must call them in an entity function.
Best regards. The my parameter can only be used in a function called when creating the entity or with its action set in WED, then any subsequent functions called by these will also retain the my pointer try something like
#include <acknex.h>
#include <default.c>
action none(){
my.ambient = 50;
my.lightrange = 300;
vec_set(my.blue,vector(255,50,50));
set(me,BRIGHT);
vec_scale(my.scale_x,0.15);
}
void create_entity(){
ent_create("2.mdl", vector(1000, 50, -40), none);
}
function main()
{
video_mode = 7; //sets video to 800x600 (which is already default)
screen_color.blue = 150; //is useless, loading a level doesn't display any screen color
//use sky_color to change this
level_load(NULL);
on_space = create_entity;
}
this will allow you to keep pressing space to create entities if you only want to be able to create one either do this by: creating a variable for storing if the entity has been created or set on_space to NULL hope this helps
|
|
|
|