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
1 registered members (TipmyPip), 18,574 guests, and 6 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
Gems game problem #243204
12/28/08 19:22
12/28/08 19:22
Joined: Mar 2004
Posts: 71
Scotland
westray Offline OP
Junior Member
westray  Offline OP
Junior Member

Joined: Mar 2004
Posts: 71
Scotland
I am attempting to make a gems type game in 2D.Is there any way of storing the various colours of the gems in an array so that I can make a panel using the pan_create command.

psuedo code pan_create(array[n],5);

This is so I could generate a random number and make a panel with a colour based on this number.
Hope you can help.

Re: Gems game problem [Re: westray] #243208
12/28/08 19:42
12/28/08 19:42
Joined: Jan 2007
Posts: 1,619
Germany
Scorpion Offline
Serious User
Happy Birthday Scorpion  Offline
Serious User

Joined: Jan 2007
Posts: 1,619
Germany
there are different ways how to do it..you could save whole panel definitions in a string* array and call pan_create with them..or you just use an bmap* array.

example for the 2nd method:

Code:
define gemTypes 3

BMAP* gemMap[gemTypes];

void createGemBMAPs_startup(){
    //you can do this in a for loop, too
    //if you have uniform filenames like gem1, 2, 3
    gemMap[0] = bmap_create("gem_red.tga");
    gemMap[1] = bmap_create("gem_green.tga");
    gemMap[2] = bmap_create("gem_blue.tga");
}

PANEL* createNewGem(VECTOR* pos, int gemType){
    PANEL* tempPan = pan_create("",5);
    set(tempPan,VISIBLE);
    tempPan.pos_x = pos.x;
    tempPan.pos_y = pos.y;
    tempPan.bmap = gemMap[gemType];
    tempPan.size_x = bmap_width(tempPan.bmap);
    tempPan.size_y = bmap_height(tempPan.bmap);
    return tempPan;
}


Have fun =)


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