Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
3 registered members (NewbieZorro, TipmyPip, 1 invisible), 19,045 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 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 | 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