how would this work?

Non-platform specific questions.

how would this work?

Postby sonicfire » Mon Mar 28, 2011 6:46 pm

hi fellaz! :)

in my actor´s creation event i have "Actor *theleg;" for example.
HOW can i access this pointer in the actor´s draw event?

For example:

Code: Select all
    theleg->x = blabla;




The problem is that the variable "theleg" somehow doesn´t exist in the drawevent.
But i cant make it global using code since i need it for any actor seperately.
Hope my post makes sense. Any help / ideas ? :)

Thanks in advance!
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Re: how would this work?

Postby Game A Gogo » Mon Mar 28, 2011 8:04 pm

put the "Actor *Myactor;" in the global code. Variables declared INSIDE a script will only exist INSIDE the specific script!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: how would this work?

Postby sonicfire » Tue Mar 29, 2011 2:51 pm

Ah :shock: Makes sense! So you mean i would just do a global code script only with e.g. "Actor *xyz;" in it?
What would i need to call it? Do i have to call this script simply in my actor then?

Thanks!
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Re: how would this work?

Postby schnellboot » Tue Mar 29, 2011 3:12 pm

sonicfire wrote:Ah :shock: Makes sense! So you mean i would just do a global code script only with e.g. "Actor *xyz;" in it?
What would i need to call it? Do i have to call this script simply in my actor then?

Thanks!

you don't have to make a single script for that
just paste it somewhere in global code
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: how would this work?

Postby sonicfire » Wed Mar 30, 2011 6:26 am

will give it a try , thanks! :)
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Re: how would this work?

Postby rykein » Wed Mar 30, 2011 6:31 am

schnellboot wrote:
sonicfire wrote:Ah :shock: Makes sense! So you mean i would just do a global code script only with e.g. "Actor *xyz;" in it?
What would i need to call it? Do i have to call this script simply in my actor then?

Thanks!

you don't have to make a single script for that
just paste it somewhere in global code

global code is still made up of scripts. but you never call a global script. just functions declared in teh script.
rykein
 
Posts: 63
Joined: Mon Jul 26, 2010 7:26 am
Score: 6 Give a positive score

Re: how would this work?

Postby schnellboot » Wed Mar 30, 2011 8:24 am

in global code you can put in functions or just declarations
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: how would this work?

Postby rykein » Wed Mar 30, 2011 8:32 am

yeah...... i know. didnt say anything to disagree with that. the fact of the matter is that you do need to make a script in global code because global code is a place to make a bunch of global scripts. but in this case all it is is a single declaration.
rykein
 
Posts: 63
Joined: Mon Jul 26, 2010 7:26 am
Score: 6 Give a positive score

Re: how would this work?

Postby schnellboot » Wed Mar 30, 2011 8:37 am

ahh alright
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest