Gamestudio Links
Zorro Links
Newest Posts
Executing Trades on Next Bar Open
by vicknick. 06/13/24 08:51
Zorro Beta 2.61: PyTorch
by jcl. 06/10/24 14:42
New FXCM FIX Plugin
by flink. 06/04/24 07:30
AlpacaZorroPlugin v1.3.0 Released
by kzhao. 05/22/24 13:41
Free Live Data for Zorro with Paper Trading?
by AbrahamR. 05/18/24 13:28
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (Ayumi), 1,170 guests, and 2 spiders.
Key: Admin, Global Mod, Mod
Newest Members
AemStones, LucasJoshua, Baklazhan, Hanky27, firatv
19059 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 | 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