Re: bgt, having trouble with classes, again

2015-10-24 Thread AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector


  


Re: bgt, having trouble with classes, again

Thanks cae_jones. Slowly I'm putting this together.coltonhill,I would be glad to receive your assistance. You may send me a forum email. If you want my twitter its @firebird1409

URL: http://forum.audiogames.net/viewtopic.php?pid=235978#p235978





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bgt, having trouble with classes, again

2015-10-23 Thread AudioGames . net Forum — Developers room : coltonhill01 via Audiogames-reflector


  


Re: bgt, having trouble with classes, again

Omar, I would be more than happy to help you. If you want, just add me on skype and i can help you with almost anything oyu need help with with bgt. As long as you're not using geometry... Cae's your go to for that.

URL: http://forum.audiogames.net/viewtopic.php?pid=235976#p235976





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bgt, having trouble with classes, again

2015-10-23 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: bgt, having trouble with classes, again

The error it gave points to this line: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)It should be:if(shipx-3==barrier.x or shipx-2==barrier.x or shipx-1==barrier.x or shipx==barrier.x or shipx+1==barrier.x or shipx+2==barrier.x or shipx+3==barrier.x)However, there is a much simpler way to accomplish that condition:if(absolute(barrier.x-shipx)<=3)^ Since you want to know if the distance between shipx and the barrier is less than or equal to 3, just take the absolute value of the difference, and that is the total distance.A problem you will run up on rather quickly is writing collision detection for all the different walls. A way to speed this up would be to add a method to the wall class. It might be something like:bool contains(int px, int py) {return (absolute(x-px)<=3 and absolute(y-py)<=3);}Or 
 something like that.As for handles in general... if you need an object to be a property of a class, or if you just need an object to survive multiple scopes, or if you need an array of objects, you'll need to use handles. You can treat handles like the objects they point to for almost everything; you mostly only need to bother with the at sign for assignment and equality (E.G., if(@handle==null) ). The biggest difference between handles and regular variables is that variables get copied when they are assigned, but multiple handles can still point to the same object.

URL: http://forum.audiogames.net/viewtopic.php?pid=235966#p235966





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bgt, having trouble with classes, again

2015-10-23 Thread AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector


  


Re: bgt, having trouble with classes, again

is anyone willing to help me any further?I'm still confused at post 8, and have tried re reading the chapter on objects, classes and handles.I get the idea of classes, just handles themselves confuse me.

URL: http://forum.audiogames.net/viewtopic.php?pid=235963#p235963





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bgt, having trouble with classes, again

2015-10-22 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: bgt, having trouble with classes, again

It looks like you aren't storing the walls you're creating. If I understand the code correctly, the newgame function does this:

URL: http://forum.audiogames.net/viewtopic.php?pid=235793#p235793





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bgt, having trouble with classes, again

2015-10-22 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: bgt, having trouble with classes, again

It looks like you aren't storing the walls you're creating. If I understand the code correctly, the newgame function does this:assign shipx, shipy, and speed (global variables)play the engine sound, and assign its slot number to the global variable engineCreate a local variable i, initialize it to 0Since i is less than 6500, do the following:create a local variable called barrier, that is a wall with random parameters.delete barrier, since this iteration of hte loop is complete.increment i.repeat the last 4 lines until i is 6500 (Incidentally, that is a lot of objects and the sound pool will probably explode.)delete i, since the loop is complete.Create a local wall variable.Call gameloop.Delete barrierThe barrier variable created inside newgame (or inside the loop) cannot be accessed by any other functions. You probably want a global variable--in this case, probably an array or dictiona
 ry--to hold all the walls created in the loop.Try taking the linewall barrier(50, 350, 0);And either putting it outside the function, putting it at the start of gameloop, or splitting it into three lines:wall@ barrier; //outside of any functions or classes.// inside newgame:wall temp(50, 350, 0);@barrier=temp;I think BGT will complain about the last one, because something something constructors. It'd be easier just to move wall barrier(50, 350, 0); into a different scope.

URL: http://forum.audiogames.net/viewtopic.php?pid=235793#p235793





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bgt, having trouble with classes, again

2015-10-22 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: bgt, having trouble with classes, again

(Sorry, somehow it hit submit before I finished writing the post. I tried to edit more detail in.)

URL: http://forum.audiogames.net/viewtopic.php?pid=235796#p235796





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bgt, having trouble with classes, again

2015-10-22 Thread AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector


  


Re: bgt, having trouble with classes, again

er, crap.This is really my first time attempting to use classes. What would be the ideal way to set and store the walls then?Thanks for your reply.

URL: http://forum.audiogames.net/viewtopic.php?pid=235794#p235794





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bgt, having trouble with classes, again

2015-10-22 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: bgt, having trouble with classes, again

That was what your current code does.What you want to do is more like this:for(uint i=0; i<wall_num; i++) {wall barrier(random(0, 100), random(0, 100), random(0, 100));walls.insert_last(barrier);}Assuming that you have an array of walls, which needs to take handles, like so:wall@[] walls;Also, if BGT complains about "no default constructor", just add the line "wall() {}" to the wall class.

URL: http://forum.audiogames.net/viewtopic.php?pid=235818#p235818





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bgt, having trouble with classes, again

2015-10-22 Thread AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector


  


Re: bgt, having trouble with classes, again

I mostly understand what your saying, but beyond this my head exploded:create a local variable called barrier, that is a wall with random parameters.delete barrier, since this iteration of hte loop is complete.increment i.repeat the last 4 lines until i is 6500 (Incidentally, that is a lot of objects and the sound pool will probably explode.)delete i, since the loop is complete.Create a local wall variable.I suspect all of this will be done in a forloop, but unfortunately my head explodes every time I attempt to put it into code.

URL: http://forum.audiogames.net/viewtopic.php?pid=235811#p235811





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bgt, having trouble with classes, again

2015-10-22 Thread AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector


  


Re: bgt, having trouble with classes, again

I've done all the necessary modifications to the code and I now get the following error when attempting to run. Is this me being an idiot or is there something severely wrong?File: D:\spaceshiptest\game.bgtOn line: 68 (1)Information: Compiling void gameloop()File: D:\spaceshiptest\game.bgtOn line: 76 (97)Line: 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)Error: No conversion from 'wall@&' to 'int' available.File: D:\spaceshiptest\game.bgtOn line: 76 (117)Line: 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)Error: No conversion from 'wall@&' to 'int' available.File: D:\spaceshiptest\game.bgtOn line: 76 (137)Line: if(shipx-3==barrier.x or shipx-2==b
 arrier.x or shipx-1==barrier.x or shipx==barrier.x or shipx+1==barrier or shipx+2==barrier or shipx+3==barrier)Error: No conversion from 'wall@&' to 'int' available.modified code is below#include "sound_pool.bgt";wall@ barrier; //outside of any functions or classes.wall@[]walls;sound_pool pool(500);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);}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=1.75;pool.pan_step=.85;pool.behind_pitch_decrease=4;show_game_window("Cannon crossfire: Civilian lines.");voice.speak_wait("loading sounds. Pliz wait.");newgame();}void newgame(){// inside newgame:wall temp(50, 350, 0);@barrier=temp;shipx=50;shipy=0;speed=80;engine=pool.play_stationary("sounds/engine.ogg", true, true);int wall_num=400;for(uint i=0; i<wall_num; i++) {wall barrier(random(0, 100), random(0, 3000), random(0, 100));walls.insert_last(barrier);wall@[] walls;}//wall barrier(50, 350, 0);gameloop();}void gameloop(){speedtimer.resume();while(true){wait(10);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);}}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[engine].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+", 
 uot;+shipy);}if(key_pressed(KEY_S)){voice.speak_interrupt(speed);}}}

URL: http://forum.audiogames.net/viewtopic.php?pid=235828#p235828





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bgt, having trouble with classes, again

2015-10-22 Thread AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector


  


Re: bgt, having trouble with classes, again

I think so, I would like to point out this is my first attempt at using classes. And handles to objects confuse the royal crap out of me.Thanks for all your help

URL: http://forum.audiogames.net/viewtopic.php?pid=235834#p235834





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector

Re: bgt, having trouble with classes, again

2015-10-22 Thread AudioGames . net Forum — Developers room : CAE_Jones via Audiogames-reflector


  


Re: bgt, having trouble with classes, again

The trouble is with the parts that say "==barrier" without any properties (barrier.x? barrier.y?).

URL: http://forum.audiogames.net/viewtopic.php?pid=235833#p235833





___
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector