Gamestudio Links
Zorro Links
Newest Posts
loading historical data 1st time
by AndrewAMD. 04/14/23 12:54
Trade at bar open
by juanex. 04/13/23 19:43
Bug in Highpass2 filter
by rki. 04/13/23 09:54
Adding Limit Orders For IB
by scatters. 04/11/23 16:16
FisherN
by rki. 04/11/23 08:38
AUM Magazine
Latest Screens
SHADOW (2014)
DEAD TASTE
Tactics of World War I
Hecknex World
Who's Online Now
3 registered members (AndrewAMD, Grant, Neb), 908 guests, and 6 spiders.
Key: Admin, Global Mod, Mod
Newest Members
rki, FranzIII, indonesiae, The_Judge, storrealba
18919 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