Re: Newb Needing Help With Classes In BGT

Hi again,
Remind me to 1, never write example code half asleep and,
2, remind me to actually explain where to put things. Rofl!
Ok, let me clear up some confusion. For the record, I'm not bashing anyone but myself, since bgt itself is quite confusing.
As for the reason the trampoline example is failing, I believe it's because you need to declare the class first. Either that, or it needs to be in a function.
I'm going to try and provide an example of looping through all of the array of trampolines and doing a forloop through them. Last time I tried this the forum ate the example. LOL!
So, you basically say, for i = 0 semi, i less than trampolines dot length semi, i plus plus
What this is doing is, starting a loop at 0, which is position 0 in the array remember, not position 0 on the map, and going as long as the array is. And what I mean by that is, it goes for however many objects (trampolines) in the array.
Very important. I don't really know what this does, but when I omit it from a class check in my games, things break, very badly.
If left paren at sign left bracket i right bracket exclamation equals null right paren.
Note. I really don't know what this does, I'm guessing it checks to ensure the position of i in the forloop is not! Null.
Now, here is where your checks go.
What you do here, say you wanna compare a trampoline x to the player's x.
if left paren trampolines left bracket i right bracket dot x==player_x right paren
Then all the usual checks can go after that.
Handy tip, it's better to do things in the class scope, so all you have to do, is this.
Note. Major confusion follows. Skip passed if you think you want to stick with the example given here.
When you want to code a function in the class level scope, before! You close the class completely, you can code any function you want, just like you would a normal function, jus t keep in mind where you stand with your variables, if they are global or in the current scope only, or if you need to get a variable from another function (return).
So, here's a generic class that takes no arguments, but shows functions inside a class, hopefully.
class something
{
All your variables you want go here.
constructor follows here.
Treat this as the right brace to the constructor.
Void function
{
Put everything you want this function to do here
}
}
The beauty of this is that, now in a function somewhere in your gameloop, all you need to have is something that loops through all the array entries in the class, and calls the internal function.
So let's demonstrate this, and say, for instance, in your trampoline class, you have a function called act.
For left paren i=0 semi i<trampolines.length semi i++ right paren
{
if left paren @left bracket i right bracket Exclamation point=null right paren
{
trampolines left bracket i right bracket dot act left paren right paren;
}
}
Much cleaner in the while loop, but eh, there ya go. 2 ways of coding checks for a class.
Hope this is a lot more helpful. LOL.

_______________________________________________
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 : lukas via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : ross via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : ross via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : ross via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : lukas via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : lukas via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : ross via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : lukas via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : ross via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : ross via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : lukas via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : ross via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : ross via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : ross via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : ross via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector
  • ... AudioGames . net Forum — Developers room : ross via Audiogames-reflector

Reply via email to