Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (7th_zorro, AndrewAMD), 1,079 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
pointer... need help #447477
12/15/14 04:44
12/15/14 04:44
Joined: Jul 2009
Posts: 85
A
Altarius Offline OP
Junior Member
Altarius  Offline OP
Junior Member
A

Joined: Jul 2009
Posts: 85
Hi,

void Attack(){

if(my.STATE_MACHINE == ATTACK
{
return;
}
my.STATE_MACHINE = ATTACK;
}

it work if i acces this function inside a while loop whit:

if(mouse_left == 1) {Attack();}

it crash if i acces this function outside a while loop whit:

on_mouse_left = Attack;

i think the problem its the pointer "my".
Is there a way too keep the "my" pointer there and use on_mouse_left = Attack; wihtout getting crash...

thx

Re: pointer... need help [Re: Altarius] #447479
12/15/14 10:03
12/15/14 10:03
Joined: Oct 2011
Posts: 1,082
Germany
C
Ch40zzC0d3r Offline
Serious User
Ch40zzC0d3r  Offline
Serious User
C

Joined: Oct 2011
Posts: 1,082
Germany
Just save the pointer in a self delcared variable:
Code:
ENTITY *pPlayer = NULL; //Global
...
pPlayer = me; //In your entity action



or use the predefined pointer called "player"

Last edited by Ch40zzC0d3r; 12/15/14 10:03.

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