Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - XanthorXIII

#46
Same thing just happened to me. However I unfolded and it's now compiling correctly for me again.
#47
My approach to this is working by the way as far as I can pass the TYPES to the functions and this is including TYPES that I am passing to Functions that are in a different Type.
I had a game semi working but went back through doing a lot of clean up and I think the effort will be worth it.
#48
Quote from: Kitty Hello on 2011-May-09
Uhm. Types and Arrays are always passed by reference.

Kitty - I got that figured out from the documentation. Let me clarify what I am asking. When passing an object to a function, do we always have to include the AS keyword.

Example

FUNCTION foo: object AS cat
      PRINT "Cat's Age is: object.age,10,10
ENDFUNCTION

Or can I just do the above as


FUNCTION foo: object
      PRINT "Cat's Age is: object.age,10,10
ENDFUNCTION

My goal is to create functions that I can throw into a file and then include that file into any project I make. Then I can pass any object to those functions I need
barring that I know what I can actually pass to that function


Thanks!
#49
Speaking of which, if I'm going to pass the reference of the object or Type, would it be possible to pass without using the AS qualifier? Good case for Generics?
#50
Ok, I thought it did but I guess with no access to pointers we can't really screw up by allocating memory and not freeing it when we are done. I think my point about Globals is still valid but if you can manage them, they really shouldn't cause problems, just a pain if you have to go back and reset the values each time you start a new game, as an example.
#51
The big problem though as I was thinking it through was that if you started a new game and had to modify a Global is that you would need to reset the Global back to it's original state if you needed the original value.

For example.
The game has three modes of play. In each mode you start with three lives. If you have just use one variable for Lives as a Global and set it to three, if you don't reset that variable to three when you initialize a mode, you could end up going from one mode to another and find that you have less lives or none at all.
The way I'm starting to think they should be used would be as Constants and that is it. Not even for Types as it would require that you do some clean up for Types. Why not let the function go out of scope and let the object get cleaned up. The way I understand it is that GLBasic has automatic garbage collection and can do this without trouble or memory leaks.
#52
Generally I have a semi working game but I'm always looking for ways to improve it. I noticed the Createscreen/Usescreen and while I understand how to use them is there a benefit to using them?
I was almost thinking about something like a Pause Screen or Menus.
Does anyone have some good uses for them?
#53
QuotePerfectly neat and compliant code to match the nit pickers of this world won't make your game any better :)
Good quote there.

I was doing some work last night and doing some reading up on TYPES and Arrays. It's almost silly to have an Array that I have to pass to the function because those are already pass by reference, which is the same as Types.
So really Local and Global doesn't matter in as much, however I think having good comments and functions organized would probably do me more good then to worry about Local vs Global.
#54
Shouldn't the compiler already know what the declared variables from program are? Then it's just a matter of it copying to those values when they are needed?
#55
Quick question for those that have been doing this longer than I have, but what is your opinion on using Global for declaring variables. Is it ok in some cases and try not to whenever? Is there a danger to me using them aside from the you may change a value somewhere and not know about it?
Just general thoughts, not looking to start a bar brawl.
#56
Unfortunately I think this requires one to get the devices the plan to run their games on so they can test before release. It's part of the cost of development however I can feel your pain if you don't have an iPad ether, those things cost too much. I'll probably wait until they are on Woot or Apple to get a refurbed.
In the mean time I'll probably have to do the same thing.
#57
After re-thinking my code some I figured out that since I wanted to do multiple checks why not have a flag that says a collision has taken place. So I loop through the array of items, check for a collision it sets the flag to true, deletes the item and checks for the next one. After I do all that I then have my object that is moving react to the hit flag and poof, my problem has been solved.
I still will probably put in Timer Based movement but this makes my game run so much better.
#58
I think that sounds about right. The object I'm using is 44 pixels W/H and the smaller object is 20 pixels. The objects that are 20 pixels are stationary.
#59
I'll probably be correct on this but does collision and timer based movement go hand in hand? I'm having a slightly odd problem with collision. I have a large object colliding with smaller objects using ether Box or Sprcoll. I found that while both sometimes works I've noticed that at certain angles when it collides, it goes straight through the object. I wonder if I need to put the timerbased movement into my game to correct this issue.
#60
Pretty addicting.