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

Topics - XanthorXIII

Long time no see ;) I'm thinking about adding Prototypes to my game. The reasoning for this is wanting Callbacks. Am I correct that I can use Prototypes in this manner?
Does anyone have a recommendation for Sound/Music Artist? I'm looking for someone that does Electronic/Trance kind of music.
Math / Object Counter
Thought I would share this handy object counter. Essentially it's an Eggtimer that you set and check to see if a specified time period in seconds has been reached. Thanks to MrTAToad for the concept from his AppTimer especially the Pause Function from it that solved a math issue I was having.

You start by creating the object with a given time in seconds using the InitializeTimer function. Then once per update loop you call the UpdateTimer on the object. Then after that you call the CheckTimer when you want to see if the Timer is up. If it is, it will reset itself for the next round. If you want to reset the timer before it hits the time it has been set to without changing that value, call the ResetTimer function. If you want to to change the timer to a new value call
ChangeTimer and pass the seconds you want to change the timer to which also resets the timer at the same time.

By the way if you have a better way of doing this or any suggestions/errors you find, please let me know, I'm open to all possibilities. :)

Code (glbasic) Select
TYPE GameObjectTimer

initialTime = 0
deltaTime = 0
countTime = 0
pausedTime = 0
elapsedTime = 0
paused = FALSE

// Initialize the amount of time you want to pass before the trigger
FUNCTION InitializeTimer: countTo
self.initialTime = GETTIMERALL()
self.countTime = countTo
self.paused = FALSE

// Call once per update loop
FUNCTION UpdateTimer:
IF self.paused = FALSE
self.deltaTime = GETTIMERALL()-self.initialTime

// Call after the UpdateTimer. This needs to be called or the timer will never reset
FUNCTION CheckTimer:
IF self.paused = FALSE
IF INTEGER(self.deltaTime/1000) >= self.countTime

// If you want to reset the timer but keep the orignal value for your check, use this
FUNCTION ResetTimer:

self.initialTime = GETTIMERALL()


// If you want to change the value that gets checked on, it also calls ResetTimer()
FUNCTION ChangeTimer: startTime

self.countTime = startTime

//Call this function when you pause the game passing in TRUE to pause and FALSE to unpause it
FUNCTION PauseTimer: isPaused
IF isPaused
self.pausedTime = GETTIMERALL()
self.paused = TRUE
self.elapsedTime = GETTIMERALL()-self.pausedTime
self.initialTime = self.initialTime+self.elapsedTime
self.paused = FALSE



Sample Program

Code (glbasic) Select
LOCAL testTime AS GameObjectTimer
LOCAL pauseTheTime = FALSE
LOCAL PkeyPressed = FALSE
LOCAL UkeyPressed = FALSE



IF KEY(25) AND PkeyPressed = FALSE
PkeyPressed = TRUE

PkeyPressed = FALSE

IF KEY(22) AND UkeyPressed = FALSE
UkeyPressed = TRUE

UkeyPressed = FALSE

PRINT testTime.deltaTime,10,10
PRINT testTime.initialTime,10,20
PRINT testTime.pausedTime,10,30

So after building the Main portions for my game, I'm running into slight issues where the game is jerky. The main game play starts up fine but after a bit it jerks a little bit and then goes back to being fine. I've implement MrTAToad's AppTimer which I call once per game loop and pass it to whatever needs it to update their movement. If I set the game to LIMITFPS -1, the game doesn't do this, however if I leave it at the default of 60, the game jerks a bit.
Is it also possible that I may have too many function calls?
I don't need specific answers but just some general guidance on what I should probably avoid or try doing different.
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?
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.
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.
I was doing some lookup on this but maybe Kitty and Tru have already looked at this.

PowerVR for Graphics. Would this possibly help with the memory usage on the iPhone/iPad cutting down the size of the graphics?
Crazy Question of the day. Wasn't there an option to send someone a beer on the forums here? I could have sworn I saw that at one point.
Does anyone know of Touch Controls that are like a pool game where you Angle the pool stick around a ball, draw back the pool stick and then when you let go it fires?
I'm trying to work this out and having a little bit of a challenge.
for some of the tutorials in the Deutsch section to be translated to English. Sure I could use Google Translate but not all of the information may not be translated  correctly.

Does anyone have any code examples of constraining a drag-able object within a boundary?
I'm trying to figure this out and I seem to be running into a logic problem whenever I hit the bounds I've set the object just stays there.
I'm not sure if this has been discussed before but I think we need device specific sections on the forums.
Such as iPhone/iPod Touch/iPad, WebOS, Android(*cough*) GP32X etc....I'm seeing where some code and examples can be found in different sections on the forum. They really should be unified to a dedicated forum subsection.
Xcode 4 is out now!
Looks like a good deal. However it runs $4.99 for Non Paying Apple Developers through the Mac Store. It's free for those that already have a developer membership.
The iPhone is headed to Verizon and will be available next month.
This was just confirmed at the live event.
Good news for me who is wanting a different phone and a different network.
Off Topic / Happy New Year
Happy New Year everyone. Don't drink too much and have a safe and enjoyable end of the year celebration.  :booze:
2011 here we come with new games and new ideas!
GLBasic - en / 8.2?
I see we have a new version but the Logfile is *Cough* still on 8.174.
Any chance for an update to this?  =D
I'm running into a slight problem with Random. I'm using GETTIMERALL() as my Seed Value. In the main game loop I have a FOREACH loop that spawns a random number of enemies. When each Enemy is spawned it generates a random start position and end position to travel to. Unless I put a Sleep after the creation of each enemy, I'm finding that the Start and End Positions on each of the enemies generated is the same values as the others that are generated. If I put it into Debug mode and run a Debug on the values to check what they are at the time of creation they come out different. When I turn it off, they go right back to being the same again.
This is very odd to me.
GLBasic - en / Simple Timer
I'm trying to program a Simple Timer using GETTIMERALL(), does anyone have simple code for calculating time elasped?