Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by Zheka. 06/20/24 14:26
Lapsa's very own thread
by rki. 06/19/24 11:27
A simple game ...
by VoroneTZ. 06/18/24 10:50
Face player all the time ...
by bbn1982. 06/18/24 10:25
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
0 registered members (), 1,227 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Mino, squik, AemStones, LucasJoshua, Baklazhan
19061 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
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 Offline OP
Newbie
DirtyDhan  Offline 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: DirtyDhan] #350283
12/15/10 04:57
12/15/10 04:57
Joined: Feb 2010
Posts: 320
TANA/Madagascar
3dgs_snake Offline
Senior Member
3dgs_snake  Offline
Senior Member

Joined: Feb 2010
Posts: 320
TANA/Madagascar
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.

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
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
Originally Posted By: 3dgs_snake
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
Code:
#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


Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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