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.


Messages - Bursar

Pages: 1 [2] 3 4 5
16
Quote
Agreed, but then you have to remember 1= "menu", 2= "game" and so-on. Strings just make the code easier to read.

You're right, using numbers in code is hard to read.  But using constants makes it clear again, such as:
Code: (glbasic) [Select]
CONSTANT STATE_MENU = 1
CONSTANT STATE_GAME = 2

SELECT player.state
CASE STATE_MENU
...
CASE STATE_GAME
...
ENDSELECT

Am I crazy, or is the 'CONSTANT' command not listed in the help file?
I was checking if you can use '%' in a constant definition, such as "CONSTANT STATE_MENU% = 1".
It doesn't give me an error, so I assume so.  It may also infer the type by the fact that is has no decimal places.

Using the above code makes my game lock up and produces the 'not responding error'. If I replace the use of the constants with actual numbers in the CASE statements, it works. Is this a bug?

Causes lockup:
Code: (glbasic) [Select]
CONSTANT STATE_MENU = 1
state = STATE_MENU

SELECT state
CASE STATE_MENU
...
ENDSELECT

Works ok:
Code: (glbasic) [Select]
CONSTANT STATE_MENU = 1
state = STATE_MENU

SELECT state
CASE 1
...
ENDSELECT

17
Thanks :)

Quote
functions that return nothing or true/false should be integer: FUNCTION foo%:
Useful to know - that's just my inexperience with the language. Took me long enough to get used to putting the colon on the end of the function name instead of brackets :)

Quote
why not using the DELETE inside the FOR loop but set a bMustBeDeleted Flag?
Because using delete causes the loop to go straight to back the top and ignore anything else below it. Again, it might just be my inexperience with GLB, and I'll be able to avoid it in future.

Quote
the "player.state$" and such might be better to be an integer and constants instead of strings
Agreed, but then you have to remember 1= "menu", 2= "game" and so-on. Strings just make the code easier to read.

Quote
The code is great!
Thanks  :enc:

18
Sorry Moru, my reply wasn't directed at you. It was a general musing.

19
Odd that some people need the thought of 'winning' a competiion to do this, rather than just attempting it anyway.

20
Right click and... oh, wait...  :nana:

21
I used a timer to delay about 250ms after a key press before it was recognised again, and although it worked perfectly for me, some ham-fisted people still managed to hold the key down for too long  ;/

22
GLBasic - en / Re: sound doesn't play anything
« on: 2010-Sep-21 »
Have you put the audio files in the application.app directory (and optionally in the Media directory if you're using that)? Have you typed the name of the directory and/or file correctly (including case)?

It's a little difficult to guess what else might be going on without code.

23
Editors that I've written in the past (not in GLB) have used a similar approach. Clicking on the map creates an object at that location, and when I save the map, I write a line that says something like: 1,0,100,245. The first number is the ID of the object I've created (1 might be a tree, 2 a rock and so-on), the second number is the rotation of the object, and then finally its X and Y position.

Loading the map is just a case of looping through the file and parsing all of the entries.

24
Take a look at the source for mt Glowing Rocks from Outer Space game. In the Globals.gbas file is a type definition for KEYCODES. Further down that file are two functions - KeyHitUpdate and KeyHit.

Put all of that into your project, and add: GLOBAL gKeys AS KEYCODES where you define the rest of your variables.

Then in your menu function you can use:
Code: (glbasic) [Select]
function mainMenu:
  while (something = something else and you stay in the main menu)
     KeyHitUpdate()
     // rest of menu display stuff
     if keyhit(28) = 2 then playGame() // Press Enter to play
     showscreen
wend
endfunction

Something like that should do it. I did grab that code form a forum posting on here, but I'm not sure who wrote it originally.

25
GLBasic - en / Re: How to clear a TYPE.
« on: 2010-Sep-21 »
If the aim is to delete all of the entities in the Type, then you could do:
Code: (glbasic) [Select]
foreach enemy in EnemyTYPE[]
   delete enemy
next

26
I've put the source code up: http://tymargames.co.uk/wp-content/uploads/2010/09/GlowingRocksSource.zip

I'd be interested in any feedback on the code, particuarly as I'm new to GLB.

27
Off Topic / Re: Hello and Good news I think
« on: 2010-Sep-17 »
Would you believe it, I've found a Mac Book Pro just sitting in a cupboard at work  8) It's a Core 2 Duo 2.2GHz with 4GB of RAM running Snow Leopard. There's also an iPhone 3GS kicking around the department (it's kind of a pool phone), but I'm sure I can snaffle it when needed.

Now to figure out how to get the company to buy a dev license for me....

28
Sorry, might not have been clear. The files have been updated, so the link in the first post will get you the updated version, but here's the link again: http://tymargames.co.uk/wp-content/uploads/2010/09/GlowingRocks.zip

I haven't changed the ZIP name. In future I'll add a v1.1 or something onto the end :)

29
OK, new version now available. If you have already downloaded the game, you can just replace the .exe file with the one in the new ZIP file so that it will retain your high scores. The link to download the complete game has been updated with the new version.

The changes are:
Increased player rotation speed
Increased safe radius check when spawning player
Altered first ufo spawning timer to give a little longer before it appears
New rocks only spawn when the ufo isn't on the screen
Medium and small rocks slightly shrunk in size
Small ufo slightly shrunk in size
Friction slightly reduced so player drifts for longer
Holding down the fire key at game over no long whizzes through the hi-score initial entry screen and starts a new game
Pressing Esc during the game brings up a pause menu rather than exiting the game

Let me know what you think, and if it needs any more tweaks :)

If there's nothing really left to change, I'll post the source code in a few days.

30
Off Topic / Re: Hello and Good news I think
« on: 2010-Sep-16 »
Quote
I think the 1000+ euro price is to include the cost of a Mac, iDevice and dev license.

Mac Mini - £650
iPod Touch - £189
Dev License - £59
Total - £898

So it turns out 1000 euros is an underestimation!  :nana:

I don't consider the Mac, iDevice etc. a tax. The license, maybe. Not the hardware itself.

And sometimes you just have to speculate to accumulate.

 :nana:
That's why I was careful to say 'price' and not 'tax'. And I agree, you get nowt for nowt :)

Pages: 1 [2] 3 4 5