Re: questions about BGT code

1 no, the window must be focussed to accept keyboard commands. There is a hide game window function but I think that's more for background operations like downloading of a file from the internet
2. I suggest you make an array of object classes and simply loop through that array
//sample skeleton code (not tested)
class object
{
int x;
int y;
string name;
object() //constructor without parameters
{
this.x=0;
this.y=0;
this.name="generic";
}
object(int x,int y,string name)
{
this.x=x;
this.y=y;
this.name=name;
}
}
object[] obj(10);//creates an array of 10 objects.
int xpos;//the player's x position
int ypos;//the player's y position
void getObjects()
{
for(uint x=0;x<obj.length();;x++) //This loops through each object. If the player's x and y position matches its x and y, it will remove it from the game grid.
{
if (xpos==obj[x].x&&ypos=obj[x].y) {
//place function call to get the object
obj.remove_at(x);//get rid of the object from the ground
}
}
}
3 yes, you can use a for loop that counts from 0 to 9 to initialize 10 objects. You can use the insert_last method on your array to insert a new object at the end of your array, like this:
obj.insert_last(object(4,4,"med kit"))

URL: http://forum.audiogames.net/viewtopic.php?pid=173081#p173081

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
http://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • Re: [Audiogam... AudioGames.net Forum — General Game Discussion: the doctor
    • Re: [Aud... AudioGames.net Forum — General Game Discussion: keyIsFull
    • Re: [Aud... AudioGames.net Forum — General Game Discussion: the doctor
    • Re: [Aud... AudioGames.net Forum — General Game Discussion: the doctor
    • Re: [Aud... AudioGames.net Forum — General Game Discussion: keyIsFull

Reply via email to