bgt, having trouble with classes, again

I'm developing a game which I hope you guys will like, but I'm having some issues.
I've had these issues before, and was never really able to come upon a surefire solution.
The code is in very early beta stages at the moment, so I will go ahead and paste it here.
But before I do, allow me to explain the issue I'm having.
I am using a class to define walls and traps (walls only currently), that the player will have to fly around.
Allow me to explain what I'm doing.
I want to check if the player is on the same x axis as a wall, and if the y position is less than the walls y position, it plays an alarm sound. If they are equal, bang. Game over.
But when I go to check said stats, it complains that "barier.x is not declared", or x is not a member of int.
I think, I might need to use handles which confuse the royal crap out of me.
Ideas?
Code is here, all you need is your own sounds as specified to run it successfully.
#include "sound_pool.bgt";
sound_pool pool;
int alarmsound;
double thrust=3;
int wallsound;
int thrustcounter;
int engine;
int level;
int health;
int maxhealth;
double speed;
double maxspeed=40;
int spawncounter;
int shipx;
int shipy;
tts_voice voice;
timer thrusttimer;
timer speedtimer;
timer movetimer;
timer spawntimer;
class wall
{
int x;
int y;
int damage;
void update()
{
pool.update_sound_2d(wallsound, shipx, shipy);
//if(shipy<barrier.y)
{
//if(shipx-3==barrier.x or shipx-2==barrier.x or shipx-1==barrier.x or shipx==barrier.x or shipx+1==barrier or shipx+2==barrier or shipx+3==barrier)
{
alarmsound=pool.play_stationary("sounds/alarm.ogg", true, true);
}
}
}
wall(int init_x, int init_y, int init_damage)
{
x=init_x;
y=init_y;
damage=init_ damage;
wallsound=pool.play_2d("sounds/wall.ogg", shipx, shipy, x, y, true, true);
}
}
void main()
{
pool.volume_step=.35;
pool.pan_step=.05;
pool.behind_pitch_decrease=6;
show_game_window("Cannon crossfire: Civilian lines.");
voice.speak_wait("loading sounds. Pliz wait.");
newgame();
}
void newgame()
{
shipx=50;
shipy=0;
speed=80;
engine=pool.play_stationary("sounds/engine.ogg", true, true);
for(int i=0; i<6500; i++)
{
wall barrier(random(0, 100), random(0, 10000), 150);
}
wall barrier(50, 350, 0);
gameloop();
}
void gameloop()
{
speedtimer.resume();
while(true)
{
wait(10);
pool.update_listener_2d(shipx, shipy);
if(speed<=40)
{
speed=40;
force_key_up(KEY_DOWN);
}
else if(speed>42)
{
reset_forced_key(KEY_DOWN);
}
pool.items[engi ne].handle.pitch=speed;
if(speedtimer.elapsed>(7000/speed))
{
shipy++;
speed=speed+0.35;
speedtimer.restart();
pool.play_stationary("sounds/debugclick.ogg", false, false);
}
if(key_pressed(KEY_ESCAPE))
{
exit();
}
if(key_down(KEY_DOWN))
{
thrusttimer.resume();
if(thrusttimer.elapsed>thrustcounter)
{
speed=speed-thrust;
thrusttimer.restart();
}
}
if(key_pressed(KEY_C))
{
voice.speak_interrupt(shipx+", "+shipy);
}
if(key_pressed(KEY_S))
{
voice.speak_interrupt(speed);
}
}
}

_______________________________________________
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector

Reply via email to