Message Board
Message Board > Fenix / Bennu / Gemix / DIV > Passing the adress of a variable to a process by parameter. |
April 3, 2007, 11:23 | |
Quiest
now with more happynes 142 posts |
Hey people! I need to do the following: I have a process that has three "sub"processes. Its my process exhaust for a space ship. I want to tell the exhaust() by parameter, which key activates it. Like in the process ship(): Code: begin ... exhaust(x_mod,y_mod,dir1, ->KEY1<-); exhaust(x_mod,y_mod,dir2, ->KEY2<-); exhaust(x_mod,y_mod,dir3, ->KEY3<-); ... How would I have to do this? I hope the question is clear enough Thanks. EDIT: btw, I`m using 084, and when I try a int pointer as parameter, it says "parameter type invalid". [Edited on April 3, 2007 by Quiest] ____________ Roundhousekick to the face, baby! |
# |
April 3, 2007, 14:06 | |
Eckolin
Quite Whiskered 388 posts |
You can pass an integer with the key constant as value. Code: exhaust(x_mod,y_mod,dir1,_up); and have Code: if (key(param)) //do stuff end in exhaust(), if that's what you were asking... Alternatively you can use an int pointer to some (global) int and set this global int to true or false depending on which key(s) are pressed. Code: key_pressed; begin exhaust(0,0,0,&key_pressed); loop if (Key(_up)) key_pressed=true;else key_pressed=false;end frame; end end process exhaust(x_mod,y_mod,dir1,int pointer bla); begin loop if (*bla) // Whatever needs to be done. end frame; end end ____________ Maker of Games... Wisdom is supreme; therefore get wisdom. Need help with coding? I probably wrote something similar. |
# |
April 3, 2007, 15:38 | |
Quiest
now with more happynes 142 posts |
thanks, Moogle already helped me over msn. I was trying the pointer stuff before but made some silly mistakes, that made me post here. Its fixed and working now. ____________ Roundhousekick to the face, baby! |
# |
Message Board > Fenix / Bennu / Gemix / DIV > Passing the adress of a variable to a process by parameter.