Re: is there a better way to do this? (bgt)

bgt lover wrote:

I don't remember many things about bgt, but, I'm more than sure that when I see such a jumble of global variables, a class should be thought about, don't you? I DK whether you reached classes yet, so I won't try to point out anything untill I'm sure you know what I'm talking about, don't want to confuse you any further. And, as a sidenote, if you're going further with this rpg thing, i'd suggest you better think abit about the design, instead of just writing some code, OK? believe me, I learned this hard lesson on my own, with a slightly larger concept demo thingi, I tell you it was messy as hell, I had to remake most of the code to be able to continue. So, I don't want anyone else to go through that horible pain, as much as I can prevent it, anyway.
First thing, your code with shift+l was right, as far as I remember bgt functions.
As to your question in the code, this is kind of the way you should have written that piece with player speed and the arrow keys:
if (key_down(KEY_RIGHT)&&walk_timer.elapsed>=speed*100)//do the following only after the player was still for that amount of time, in this case, 600 ms.
{
walk_timer.restart();
x+=1;
p.play_stationary("sounds/footstep"+random(1,3)+".ogg",false);
}
if (key_down(KEY_LEFT)&&walk_timer.elapsed>=speed*100)//the same thing
{
walk_timer.restart();
x-=1;
p.play_stationary("sounds/footstep"+random(1,3)+".ogg",false);
}
So, so much about my insanely long wall of text again, hope it at least helped you abit.

I was just testing thru pure boredom. no, I haven't reached classes yet. I don't really understand it. classes I mean.

-- 
Audiogames-reflector mailing list
Audiogames-reflector@sabahattin-gucukoglu.com
https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Gaki_shonen via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : bgt lover via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Gaki_shonen via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : bgt lover via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Gaki_shonen via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Gaki_shonen via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : amerikranian via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : JayJay via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : Gaki_shonen via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : pool via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : JayJay via Audiogames-reflector
    • ... AudioGames . net Forum — Developers room : camlorn via Audiogames-reflector

Reply via email to