Re: Newb Needing Help With Classes In BGT

2016-08-21 Thread AudioGames . net Forum — Developers room : ross via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

@Omar AlvaradoWhile that is useful advice, I'm not sure if it explains why it's not adjusting the volume in game. I already call it before the game loads, and then upon exiting, but page up/down aren't even adjusting when I'm playing the game. What I'm wondering is, they're two completely different function, why would storing it in a dictionary interfere with adjusting the music volume?

URL: http://forum.audiogames.net/viewtopic.php?pid=275455#p275455





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

Re: Newb Needing Help With Classes In BGT

2016-08-21 Thread AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

hi,I don't know when or how your loading your save data, but a lot of people prefer to load save data at startup, and save at exit or when needed.What I would do is this:Have the pagedown and pageup keys adjust the music, yes.When you go to save, you write the value of the music volume to the dictionary.When you go to load again preferably well before your game cycle even starts, you load that value into the respective music volume variable.Since you want to use a dictionary, you might find the dictionary.exists check useful.if(d.exists("1"))This checks to see if in a dictionary called d, a key? Called 1, exists. Note, you will first need to deserialize your data back into a dictionary.If it does and if you assigned the value of the music volume to a dictionary key of "1", get it from the dictionary.The dictionary.get method is useful for this purpose.This works for other values too, but kee
 p in mind what you set your data and keys to.Then, you can continue execution like normal and the volume should take.Hope this helps!

URL: http://forum.audiogames.net/viewtopic.php?pid=275439#p275439





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

Re: Newb Needing Help With Classes In BGT

2016-08-21 Thread AudioGames . net Forum — Developers room : ross via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

So, I have a different question, but I figured it would make more sense to just ask here instead of making a new topic.I wrote a method to adjust the volume of the background music using PageUp and PageDown. I want to add this into my dictionary, so the volume level is saved so you don't have to adjust it every time you open the game. For some reason, when I add it to the dictionary where I save variables, I can't adjust the volume in the game. I don't get any errors or anything, it just doesn't work until I comment out the code I added in the dictionary. Any help would be appreciated.

URL: http://forum.audiogames.net/viewtopic.php?pid=275423#p275423





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

Re: Newb Needing Help With Classes In BGT

2016-08-19 Thread AudioGames . net Forum — Developers room : ross via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

@Omar AlvaradoAwesome. I realized I was misplacing my at symbol. Now that I have the checks figure out, I'm going to write the code for the trampoline. I'll update you guys once I have it all written out, in case people want to mess with it.

URL: http://forum.audiogames.net/viewtopic.php?pid=275230#p275230





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

Re: Newb Needing Help With Classes In BGT

2016-08-19 Thread AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

I sent you an email, you can either reply to that or you can reply to it here on this topic.

URL: http://forum.audiogames.net/viewtopic.php?pid=275227#p275227





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

Re: Newb Needing Help With Classes In BGT

2016-08-19 Thread AudioGames . net Forum — Developers room : ross via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

Yeah, that would work out a lot better haha. You can also DM me on Twitter if you have that.

URL: http://forum.audiogames.net/viewtopic.php?pid=275220#p275220





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

Re: Newb Needing Help With Classes In BGT

2016-08-19 Thread AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

Hi,Ok, doing this over the forum isn't really working. Whenever I get around to it, I'll send you an email through the forum to not have any limitations of what I can and cannot write.

URL: http://forum.audiogames.net/viewtopic.php?pid=275213#p275213





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

Re: Newb Needing Help With Classes In BGT

2016-08-19 Thread AudioGames . net Forum — Developers room : ross via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

@Post 14So, I'm having trouble with the if statement. Here's what I have:if left paron trampolines at left bracket i right bracket exclamation = null right paron I get this error: On line: 19 (15)Line: if left paron trampolines at left bracket i right bracket exclamation = null right paronError: Expected ')'In your example, you wrote out the code as words, so I tried translating it to code. I noticed you only said at, instead of trampolines and then at. Was that intentional or just a typo. If it was intentional, how come you wouldn't put trampolines@?And if anyone could help me with the error as well, that would be great.

URL: http://forum.audiogames.net/viewtopic.php?pid=275130#p275130





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

Re: Newb Needing Help With Classes In BGT

2016-08-19 Thread AudioGames . net Forum — Developers room : lukas via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

Hi Omar,the security check to see if an array index in deed holds a valid object and not a null pointer is definitely useful. Just to let you guys know that I've never ever needed to use it myself yet. Another useful thing about having objects in arrays is that when you want to destroy the object, you can simply call my_array.remove_at (x). Whoosh, it's gone from the array, and since I only ever keep a single reference to the objects, and that's stored in the respective array, this single line also ensures that the given object is destroyed for good. Thus, I always know that if something is in the array, it's actually alive.This was just to hopefully explain some more stuff and possibly provide another approach, not to undermine your explanations or anything like that, Omar. :-)Lukas

URL: http://forum.audiogames.net/viewtopic.php?pid=275100#p275100





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

Re: Newb Needing Help With Classes In BGT

2016-08-19 Thread AudioGames . net Forum — Developers room : ross via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

@Omar Alvarado[[wow]], this is very useful. I'm going to sit down today and tinker with this a bit. Thank you. I'll let you guys know if I got it to work or if I ran into some trouble.

URL: http://forum.audiogames.net/viewtopic.php?pid=275094#p275094





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

Re: Newb Needing Help With Classes In BGT

2016-08-18 Thread AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector


  


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 plusWhat 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 parenThen 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{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.

URL: http://forum.audiogames.net/viewtopic.php?pid=275061#p275061





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

Re: Newb Needing Help With Classes In BGT

2016-08-18 Thread AudioGames . net Forum — Developers room : ross via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

@LucasAs for as the error I'm getting, I feel rather silly. I normally would have known not to do that, but I guess staring at code for a prolonged amount of time would cause you to think differently.As far as the for loop, I agree about trying things out instead of having them handed to you. For me, since this will just be a left right game, would run a for loop that checked playerposition with the trampoline position in the array. However, I've always found arrays intimidating, so I haven't messed with them much. The part the confuses me is, if I were to check to see if, for example, trampoline in slot 0 in the array had a position of 5. Sure I can compare x to the slots of the array, but how would I check the position of the player with the trampoline that's being held within the array. I hope I'm making sense haha.Also, here is my code. I haven't had time today to tinker with it at all because I just flew back into town.
 https://www.dropbox.com/s/icw8u89s7r5hog4/Dooby.7z?dl=0

URL: http://forum.audiogames.net/viewtopic.php?pid=275037#p275037





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

Re: Newb Needing Help With Classes In BGT

2016-08-18 Thread AudioGames . net Forum — Developers room : lukas via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

Hi Ross,yeah, feel free to zip up and upload your entire code if you're okay with me checking it out. I won't be adding anything that's not there yet unless you specifically ask me to, so that you still have work to do, things to learn, and ways of implementing everything to discover, but I'll fix or improve what I think is worth doing so. :-)I've never heard of Interactive Buddy but the concept definitely sounds interesting, and I think I understand what you mean, at least I have a rough imagination. And I got the idea of placing the trampoline wherever on the map the user wants. I'll definitely be looking forward to playing this when it's finished! :-)Fortunately, your current issue with the insert_last function is pretty easy to fix. Most BGT functions, even custom ones, canot be called during global variable initialization. That means that you have to place the trampolines.insert_last(tramp) line somewhere else, inside a f
 unction. It just won't work here, at the top of your code where you declare your global variables. For now, before the trampoline placing dialog is implemented, you can probably just place it anywhere in the main function. That should do the trick for now. When the dialog is there, it would of course belong right after it.What's confusing you about the for loop? How would you go about it? Any specific ideas or issues?I'm of course willing to write it out for you if you have no clue at all, it's easy enough, but I'd just like to discuss it first if you don't mind. Figuring things out on your own greatly speeds up and deepens the learning process, from my experience. :-)Hope this helps,Lukas

URL: http://forum.audiogames.net/viewtopic.php?pid=274913#p274913





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

Re: Newb Needing Help With Classes In BGT

2016-08-17 Thread AudioGames . net Forum — Developers room : ross via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

@lukasYeah, I can do that, or what if I zipped up all my source code and provided a dropbox link? For now, I'll just post the trampoline code, but if you want all my source code so you have the full picture, I'll give a link.trampolines@[]trampoline; trampoline tramp(5);trampolines.insert_last(tramp);class trampoline{ //class openint x;trampoline(int init_x){ //tramp openx = init_x;} //tramp close} //class closeSo, right now, I pretty much have what post five suggested. I didn't add the forloop to check if the player is on it, partly because I'm getting an error with trampolines.insert_last, and partly because I'm a little confused on how to write the for loop.I should explain the concept of my game a tiny bit more. It's not exactly a sidescroller, but laid out like one. Basically you have a dummy on the map, and you have to 
 find creative ways to beat it up. There will be achievements for specific ways to beat up the dummy. It's sort of like my own version of Interactive Buddy, if you have ever heard of that.So, ultimately, I'm wanting to pull up a dialogue box that asks the user where they want to place a trampoline, and then have the trampoline be placed on the coordinates they specified.Let me know if this makes sense or if you need me to explain more.

URL: http://forum.audiogames.net/viewtopic.php?pid=274869#p274869





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

Re: Newb Needing Help With Classes In BGT

2016-08-17 Thread AudioGames . net Forum — Developers room : lukas via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

Ross,my previous post which I was probably writing at the same time as you were composing your own reply should have answered some of these questions. :-DI was thinking that it might be faster for me and more useful for you if you just posted what you have currently coded here and I tried to glance through it, correct and possibly improve it, and comment my changes to explain why I'm doing something the way I'm doing it. What do you think?Lukas

URL: http://forum.audiogames.net/viewtopic.php?pid=274868#p274868





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

Re: Newb Needing Help With Classes In BGT

2016-08-17 Thread AudioGames . net Forum — Developers room : lukas via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

Well, if you were checking dozens of active objects at once in such a for loop, and even more so if you were calling some heavily calculating methods on them rather than just simply comparing a couple variables in an if statement, it might become somewhat processor intensive, but believe me that it's probably the easiest approach to reliably managing several different objects of the same class and even several different classes at the same time.I'm doing this myself with 3 classes, one of them is allowed to have up to 60 active instances at the most at one moment, and the other two classes can have 20 each. I'm doing this on each iteration of the main game loop, calling the act method of each instance of each class through this for loop because all of them have to do something continuously, and I'm not getting any lag or processor overheat at all so far.One of the main reasons why it's not as performance intensive as you might expect without t
 rying it yourself is that the example array of trampolines as Omar declared it is in fact an array of object handles, if you noticed. That means that on each iteration of the for loop, the program will only be looking at the specified place in memory where the given object is stored, rather than creating an all new unique local copy of the exact same object just for the purposes of this single check in the for loop, if this makes sense.Another very important thing which doesn't seem to be described in enough detail in the BGT tutorials is correct usage of the wait function. Never ever use it in such iterative loops where you need to quickly glance through an entire array of objects of a certain type to see if they are doing something or in a certain state as quickly as possible. In these situations, you need the instruction to be carried out immediately. The wait function should only be used in the main loop, and only once, for 5 milliseconds only, which is probably the 
 best compromise between execution speed and CPU usage. For looping through an array of object handles should theoretically take even less than 5 milliseconds on every iteration in most cases, which is never noticeable for the player and it doesn't start using the processor hardly enough and long enough for it to notice any difference either, if you see what I mean.A very useful concept which is heavily used in mainstream games, which would probably improve performance of most current BGT games a lot, and which I myself still have to learn and adapt even though I've heard a lot about it and like it in principle, is called frames per second (FPS). Basically, you set up a global timer for the main loop which will only perform all the needed instructions if a certain amount of time has elapsed. Otherwise, the contents of the loop will be just skipped and the next iteration will be invoked (continue), until the required time has elapsed. If you say, for example, that you
 r game is running at a rate of 60 FPS, which means that the game should act 60 times a second, you check:if (frame.elapsed >= 1000/60){frame.restart();// Main loop goes here.}else{continue;}A little trick I'm currently using in the game I'm working on right now is that I know that the player is always faster than anything else in the game. I intercept keyboard input on every iteration of the main loop but I invoke all my for loops for classes only if (player.movement.elapsed >= player.speed).Hope this helps,Lukas

URL: http://forum.audiogames.net/viewtopic.php?pid=274867#p274867





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

Re: Newb Needing Help With Classes In BGT

2016-08-17 Thread AudioGames . net Forum — Developers room : ross via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

@lukasYeah, if you could write out the code, creating a trampoline, and then showing how the player will step on it, that would be nice. I did think the way in the tutorial was rather unnecessary and confusing. Also, if you could read my post directed towards post 5, maybe you could answer those questions? Thank you .

URL: http://forum.audiogames.net/viewtopic.php?pid=274864#p274864





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

Re: Newb Needing Help With Classes In BGT

2016-08-17 Thread AudioGames . net Forum — Developers room : ross via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

@Omar Alvarado[[wow]], thank you for explaining this. I'm still a little confused, but you definitely cleared up a bunch of questions I was having, especially concerning how to check if a player was on a trampoline. I do have one question. Wouldn't it be kind of resource intensive to have a forloop every time a player took a step to see if it was on a trampoline? I mean, what if I were to add other objects, would I have to run a for loop for each of those objects? Thanks for your help so far.Also, I a getting an error with this line of code: trampolines.insert_last(tramp);This is the error: On line: 3 (12)Line: trampolines.insert_last(tramp);Error: Expected identifier

URL: http://forum.audiogames.net/viewtopic.php?pid=274862#p274862





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

Re: Newb Needing Help With Classes In BGT

2016-08-17 Thread AudioGames . net Forum — Developers room : ross via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

@Omar Alvarado[[wow]], thank you for explaining this. I'm still a little confused, but you definitely cleared up a bunch of questions I was having, especially concerning how to check if a player was on a trampoline. I do have one question. Wouldn't it be kind of resource intensive to have a forloop every time a player took a step to see if it was on a trampoline? I mean, what if I were to add other objects, would I have to run a for loop for each of those objects? Thanks for your help so far.

URL: http://forum.audiogames.net/viewtopic.php?pid=274862#p274862





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

Re: Newb Needing Help With Classes In BGT

2016-08-17 Thread AudioGames . net Forum — Developers room : lukas via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

Hi Ross,before I had the time to reply, Omar has done it, and he did a great job. This is pretty much exactly what I'm doing for objects in my game world myself. If something is not clear or you need a straight out code example, let me know, I'll try to put something together when I have some more time. This is not difficult in principle though, I recommend this approach too, and if you use this, you can avoid the method of having a board array for your entire map which is described in the tutorial.Lukas

URL: http://forum.audiogames.net/viewtopic.php?pid=274861#p274861





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

Re: Newb Needing Help With Classes In BGT

2016-08-17 Thread AudioGames . net Forum — Developers room : Omar Alvarado via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

Hello there ross,If memory serves me right there is indeed a tutorial, although a very short one, on classes in the in game practice tutorials in bgt.That one left me with a lot of questions. In the end, I ended up instead of looping through the entire board array as they want you to do in the tutorial,I used an array for each class, and the array is simply a list of all the class members, if you will.So what this means is, from personal experience anyway, is that you can put a class item anywhere, even on top of an already existing class item, and if you have code to check that, nothing too bad will happen.If you use the slightly dirtier method, (to me) you can spawn as many class items as you want, however be aware if your following the tutorial for the in game practice, things could get interesting.so here is what I do for all my classes, doctored for the situation here.trampolines@[]trampoline; //creates an array of trampolines. I thin
 kclass trampoline{int x, y; //add any additional variables you want here.trampoline(int init_x, int init_y) //This creates a class constructor, so you can specify values where a trampoline can go{x=init_x;y=init_y;}//any functions you want for the class will go here.}Now, when you want to spawn a trampoline, what I do anyway, is this:In a function where spawning related things will happen, or wherever you want the trampoline to be able to be created, you can put this:trampoline tramp(desired_x, desired_y);trampolines.insert_last(tramp);Now, you have a trampoline that is ready to be used.Now, to check that a player is near or on one, you simply loop through all of them in a forloop in a function, hopefully where player movement is being performed.In the forloop you do your if checks if player x and y equal a trampoline x and y.I can't really give you an example of that spe
 cific thing since the forum keeps eating it up rargh.Eh, there might be some slight issues with the code and my braces might be off I'm using firefox to compose this reply, but there you go.Hope this helps and isn't too terribly confusing. I know how confusing classes can be, and will be willing to help as much as I can.

URL: http://forum.audiogames.net/viewtopic.php?pid=274846#p274846





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

Re: Newb Needing Help With Classes In BGT

2016-08-17 Thread AudioGames . net Forum — Developers room : ross via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

@lukasThis helps a lot, but I still have a few questions. I didn't mention this in the first post, but ultimately, I want the player to be able to spawn multiple trampolines on the maps. Could you tell me how I would do this and show me the code for it? I was reading in the manual that a user can assign properties to a variable, instead of just declaring them in the constructor of the class, if that makes sense. So I want a person to be able to, for example, select a trampoline from a menu and then type in the number on the map they wish to put it.The second thing I'm confused on is how I can have multiple instances of the trampoline, so one could be on tile 5, another on 10, etc.Also, right now, I am just using ints to keep track of the board size, playerposition, etc.Thank you for your help so far.

URL: http://forum.audiogames.net/viewtopic.php?pid=274778#p274778





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

Re: Newb Needing Help With Classes In BGT

2016-08-17 Thread AudioGames . net Forum — Developers room : lukas via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

Hi,if you have a single instance of the trampoline class, this could also be done in a much simpler way, although possibly dirtier when looked at from the perspective of what is good coding practice and what is not. :-)If you do in deed have only a single trampoline instance per level, let's assume it's called, say, tramp, because a class instance (object) is not allowed to have the same name as the class itself. So, you've already declared the class itself elsewhere, and now you are going to create your object:trampoline tramp;Now, your check to see if the player is currently standing on the trampoline could look something like this:if (playerposition == tramp.TrampolinePosition){alert ("Oops!", "There's a trampoline right here. Jump on it!");}Of course, this would have to be checked every time the player takes a step. You could have it somewhere in your main loop but then that would 
 perform unnecessarily too many checks, even when the player has not moved at all on this iteration of the main loop, and thus create unwanted performance overheat, however slight it might be. So, if you decide to use this approach, the best place for this check would probably be inside the function where player movement is handled, after everything else such as possible wall collisions has been taken care of and you are sure the player has in fact successfully taken a step.By the way, how is your map currently represented? Are you using an array or a dictionary for it, or do you just store the position of everything in its own separate variable and then check where the player is currently standing, like in the above example? For many types of games, experience has taught me that this can in fact be the most suitable approach to handling the map. The numbered approach Magur described in the previous post, where the number on each tile represents a certain terrain or item type,
  is the second obvious, probably most often used, and also very good solution, but you should probably ask yourself what you need and what you don't need for the map, how you are going to use it (i.e. will you allow the player to browse the map for the whole level, pausing gameplay in the meantime, will you allow for the map to be saved to a text file, etc). Answering these questions should probably help you to answer the main question of whether you will need an array or worse a dictionary to represent the various tiles with their terrain/item type numbers, or whether this is not going to be necessary at all. By the way, dictionaries are only worse than arrays in that they are slightly more tedious to code and they are a tiny bit slower in performance than arrays.Hope this has actually provided some helpful tips rather than just more confusion. :-)Lukas

URL: http://forum.audiogames.net/viewtopic.php?pid=274761#p274761





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

Re: Newb Needing Help With Classes In BGT

2016-08-16 Thread AudioGames . net Forum — Developers room : magurp244 via Audiogames-reflector


  


Re: Newb Needing Help With Classes In BGT

Hm, generally I approach this by having a reference to the target class in the map array, although i'm not sure that would work the same way in BGT. Another way to handle it though would be to use your "board" array as a lookup table. What that means is you represent each class or item as a number, and populate map positions with those numbers to represent their positions.So for example, lets say the playerposition is 5 x, and 5 y. So you feed that into your map array: map[y][x], and the number there is 5. At this point you could use that in an if statement that calls the target trampoline class, such as: "if map[y][x] == 5: trampoline.jump()". Heres a rough example in Python:#create a 20x20 grid
grid = []
for a in xrange(0,20,1):
grid.append([])
for b in xrange(0,20,1):
grid[a].append(0)

#set the number at 5 x by 5 y to represent a trampoline
grid[5][5] = 5

#create a player class with an x and y position
class player(object):
def __init__(self):
self.x = 5
self.y = 5

#create trampoline class
class trampoline(object):
def jump(self):
print "jump on the trampoline!"

#initialize the player class
player = player()

#initialize the trampoline class
trampoline = trampoline()

#check the players position on the grid for numbers representing objects
if grid[player.y][player.x] == 0:
print 'nothing here'
elif grid[player.y][player.x] == 1:
print "theres a post"
elif grid[player.y][player.x] == 2:
print "a tree!"
elif grid[player.y][player.x] == 3:
print "some rocks?"
elif grid[player.y][player.x] == 5:
print "theres a trampoline here!"
trampoline.jump()

URL: http://forum.audiogames.net/viewtopic.php?pid=274753#p274753





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

Newb Needing Help With Classes In BGT

2016-08-16 Thread AudioGames . net Forum — Developers room : ross via Audiogames-reflector


  


Newb Needing Help With Classes In BGT

I'll try to condense this as much as possible. I'm working on a sidescroller. In a level, I'm wanting to add a trampoline. So, I made a trampoline class and then created methods to give it detail. What I want to do is place it on the map at a location and then have a dialogue pop up when I walk over the tile it is on.So example, let's say the map is called board, the player's position is called playerposition, and the trampoline's position is called for the hell of it, TrampolinePosition and it's in the trampoline class.How do I translate it's position onto the board? I'm sorry if this doesn't make sense, I just want to understand classes as much as I can. Any other tips on classes or ways I can understand how they work would help a lot. If you want to have a direct conversation with me, feel free to shoot me a DM on Twitter. I'm really wanting to figure this out haha.Also, if there's a way someone co
 uld possibly write out what I'm trying to do, that would be amazing. I learn a lot better when I have things in front of me. Thanks.

URL: http://forum.audiogames.net/viewtopic.php?pid=274738#p274738





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

Newb Needing Help With Classes In BGT

2016-08-16 Thread AudioGames . net Forum — Developers room : ross via Audiogames-reflector


  


Newb Needing Help With Classes In BGT

I'll try to condense this as much as possible. I'm working on a sidescroller. In a level, I'm wanting to add a trampoline. So, I made a trampoline class and then created methods to give it detail. What I want to do is place it on the map at a location and then have a dialogue pop up when I walk over the tile it is on.So example, let's say the map is called board, the player's position is called playerposition, and the trampoline's position is called for the hell of it, TrampolinePosition and it's in the trampoline class.How do I translate it's position onto the board? I'm sorry if this doesn't make sense, I just want to understand classes as much as I can. Any other tips on classes or ways I can understand how they work would help a lot. If you want to have a direct conversation with me, feel free to shoot me a DM on Twitter. I'm really wanting to figure this out haha.

URL: http://forum.audiogames.net/viewtopic.php?pid=274738#p274738





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