Re: bgt walktimer code

2017-04-30 Thread AudioGames . net Forum — Developers room : brian . kurosawa via Audiogames-reflector


  


Re: bgt walktimer code

int x,y;double cooldown;void main() {step.load("Footstep.wav");while(!key_pressed(KEY_ESCAPE)) {if(cooldown>0.0) cooldown-=0.005;if(cooldown<0.0) cooldown=0.0;if((key_down(KEY_UP))&&(y<10)) walk(0,1);else if((key_down(KEY_LEFT))&&(x>0)) walk(-1,0);else if((key_down(KEY_DOWN))&&(y>0)) walk(0,-1);else if((key_down(KEY_RIGHT))&&(x<10)) walk(1,0);wait(5);}}bool walk(int x_increment,int y_increment) {if(cooldown!=0.0) return false;x+=x_increment;y+=y_increment;cooldown=0.325;step.stop();step.play();return true;}For me the best way is handling timers through double variables.

URL: http://forum.audiogames.net/viewtopic.php?pid=309094#p309094





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

Re: bgt walktimer code

2017-04-09 Thread AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector


  


Re: bgt walktimer code

Maby look i made a mistake. the walk timer should be restarted after it is elapsed.

URL: http://forum.audiogames.net/viewtopic.php?pid=306366#p306366





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

Re: bgt walktimer code

2017-04-08 Thread AudioGames . net Forum — Developers room : Bryan via Audiogames-reflector


  


Re: bgt walktimer code

Thanks! And in this game what the fault?Please, tell me.For some reason, you don't walk, simply nothing happens.The game sourcecode link.http://www.tdstudios.esy.es/side scroller.zip

URL: http://forum.audiogames.net/viewtopic.php?pid=306295#p306295





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

Re: bgt walktimer code

2017-04-08 Thread AudioGames . net Forum — Developers room : ashleygrobler04 via Audiogames-reflector


  


Re: bgt walktimer code

This might also work.int x;int y;timer walktime;sound step1;void main(){show_game_window("walktimer test");step1.load("sounds/step1.wav");while(true){if(key_down(KEY_UP) and walktime.elapsed>=300){step1.play();x+=1;}if(key_down(KEY_DOWN) and walktime.elapsed>=200){step1.play();x-=1;walktimer.restart();}and so you will carry on with the y command.I always say, to learn from an example will be the best way to learn.This is reely easy, tell me if you don't understand something, i am reely not the best with bgt, but i will try to help where i can.thanks.

URL: http://forum.audiogames.net/viewtopic.php?pid=306286#p306286





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

Re: bgt walktimer code

2017-04-08 Thread AudioGames . net Forum — Developers room : Trajectory via Audiogames-reflector


  


Re: bgt walktimer code

Run a timer. You can check how much time has passed like this:void main(){timer mytimer;show_game_window("timer test");while(mytimer.elapsed < 5000)//millisecondswait(5);}What does this do? Creates a timer, watches it until it reports that 5000 milliseconds (or 5 seconds) have passed and then quits.Now let's look at the movement side of things. Let's say you have a player class like this:class player{int x_position;int y_position;timer movement_speed;void move(){//Check if movement_speed.elapsed is greater than the interval at which you want to move.if(movement_speed.elapsed >= 250)//four steps per second, about the step interval of human running.{//do your checks here.if(key_pressed(KEY_UP))walk(forward);//forward should be defined as a const int.//...}}//and here's where you might handle walki
 ng itself.void walk(int direction){if(direction == forward){y++;//geometry. If you're moving up and down you're moving along the Y axis. If you're moving left and right you're moving along the x axis.//code to play footstep sounds goes here.//...} }}Of course this isn't complete and working, but it should give you an idea of where to start. There's more to it if you want to make a complicated game, like checking where the player is trying to step and making sure it can actually step there (for instance, making sure you can't step inside a wall).

URL: http://forum.audiogames.net/viewtopic.php?pid=306282#p306282





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

bgt walktimer code

2017-04-08 Thread AudioGames . net Forum — Developers room : Bryan via Audiogames-reflector


  


bgt walktimer code

Hi!Can you give me an example code walktimer such, which goes four directions?So forward, backward, right, left.Please help me!Regards,Bryan.

URL: http://forum.audiogames.net/viewtopic.php?pid=306256#p306256





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