Gamestudio Links
Zorro Links
Newest Posts
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
ZorroGPT
by TipmyPip. 04/08/26 17:08
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (pr0logic), 3,743 guests, and 16 spiders.
Key: Admin, Global Mod, Mod
Newest Members
VladMak, Geir, ondrej, mredit, vestriaa
19207 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
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