Gamestudio Links
Zorro Links
Newest Posts
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/20/24 01:28
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
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
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 609 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 1 of 2 1 2
small question about panels ... #376376
07/02/11 11:41
07/02/11 11:41
Joined: Aug 2010
Posts: 131
Iran
Mafia_IR Offline OP
Member
Mafia_IR  Offline OP
Member

Joined: Aug 2010
Posts: 131
Iran
Hi guys ,

i have a question , How can i create many panels with different names ? for example when i want to create a puzzle , should i create about 200 panels handy ? Can i use" while loop" or "for loop" to creating those panels ?

Thanks ...

Re: small question about panels ... [Re: Mafia_IR] #376377
07/02/11 12:43
07/02/11 12:43
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
create a Panel Array
Code:
PANEL* name[size];



and then just create a for-loop
Code:
for(var i=0; i<200; i++)
{
  name[i] = pan_create(...);
}




Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: small question about panels ... [Re: Espér] #376442
07/02/11 23:33
07/02/11 23:33
Joined: Jul 2008
Posts: 1,178
England
M
MrGuest Offline
Serious User
MrGuest  Offline
Serious User
M

Joined: Jul 2008
Posts: 1,178
England
as Esper said or use a multi-dimensional array
Code:
PANEL* name[20][10];

void main(){
  ...
  int x, y;
  for(x = 0; x < 20; x++){
    for(y = 0; y < 10; y++{
      name[x][y] = pan_create(...);
    }
  }



Re: small question about panels ... [Re: MrGuest] #376459
07/03/11 03:37
07/03/11 03:37
Joined: Dec 2008
Posts: 1,660
North America
Redeemer Offline
Serious User
Redeemer  Offline
Serious User

Joined: Dec 2008
Posts: 1,660
North America
If you're going to make a game that uses hundreds of onscreen tiles I would actually build my own drawing loop that runs through an array and draws tiles on the screen according to the contents of each index in the array. That's much more easy to manage than hundreds of unique panels, and it's also faster.


Eats commas for breakfast.

Play Barony: Cursed Edition!
Re: small question about panels ... [Re: Redeemer] #376548
07/04/11 10:44
07/04/11 10:44
Joined: Aug 2010
Posts: 131
Iran
Mafia_IR Offline OP
Member
Mafia_IR  Offline OP
Member

Joined: Aug 2010
Posts: 131
Iran
Thanks everyone !so useful ... laugh

Re: small question about panels ... [Re: Mafia_IR] #376554
07/04/11 12:15
07/04/11 12:15
Joined: Aug 2010
Posts: 131
Iran
Mafia_IR Offline OP
Member
Mafia_IR  Offline OP
Member

Joined: Aug 2010
Posts: 131
Iran
and :
How can i touch panels with mouse ? (if mouse touched panel , run function XX .)

and if mouse clicked on it, run function XXX ?

Re: small question about panels ... [Re: Mafia_IR] #376555
07/04/11 12:19
07/04/11 12:19
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany


Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: small question about panels ... [Re: Espér] #376584
07/04/11 17:49
07/04/11 17:49
Joined: Aug 2010
Posts: 131
Iran
Mafia_IR Offline OP
Member
Mafia_IR  Offline OP
Member

Joined: Aug 2010
Posts: 131
Iran
an other qestion :

how can i know what is pos_x and pos_y of panel number 8 of 30 panels that i created ?

Re: small question about panels ... [Re: Mafia_IR] #376585
07/04/11 17:50
07/04/11 17:50
Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
Espér Offline
Expert
Espér  Offline
Expert

Joined: Mar 2008
Posts: 2,247
Baden Württemberg, Germany
panelname[7].pos_x/y

._.?


Edit:
Changed 8 to 7.. cause the first position of an array starts by 0.. soo.. 8 is 7

Last edited by Espér; 07/04/11 18:36.

Selling my Acknex Engine Editions (A7 Com & A8 Pro):
>> click here if you are interested <<
Re: small question about panels ... [Re: Espér] #376627
07/05/11 09:22
07/05/11 09:22
Joined: Aug 2010
Posts: 131
Iran
Mafia_IR Offline OP
Member
Mafia_IR  Offline OP
Member

Joined: Aug 2010
Posts: 131
Iran
no , sorry i asked this wrong ! i forgot to tell "panel number x that player wants ."i meant i don't know which panel is ! for example when player wants to clicks on part X of this puzzle i should know which panel was chosen by player ...
i can use this:

on_click = function_choose ;

but function_choose should know which panel was chosen by player in game .

Page 1 of 2 1 2

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