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 - Slydog

#856
If you don't need to preserve the Null character (and speed isn't that important, or you have small strings!), you could always strip your strings ahead of time using something like (replaces all ascii '0' with ascii '1'): (Not tested)

Code (glbasic) Select

FUNCTION String_ReplaceNulls$: string$
LOCAL ix%
FOR ix = 0 TO LEN(string$) - 1
IF ASC(MID$(string$, ix, 1)) = 0 THEN string$ = MID$(string$, 0, ix-1) + CHR$(1) + MID$(string$, ix+1)
NEXT
RETURN string$
ENDFUNCTION


Also, MID$ doesn't work in reverse like some BASIC languages?  Such as:
Code (glbasic) Select
IF . . . THEN MID$(string$, ix, 1) = CHR$(1)

If modifying INSTR$ and REPLACE$ to fix this slows these commands down, perhaps adding two new functions may be better?
(INSTRB$, REPLACEB$ or something (B for Bytes like other languages), although the non 'B' versions usually offer non-case sensitive options).

Just some ideas.
#857
New subroutines may need to be added to GLBasic, and/or the existing 'GLB_ON_QUIT' be modified to be called even on being suspended to the background. 
But then you would need a corresponding 'GLB_ON_RESUME' or something. 
Or, I think you can force an app to only quit, and not multi-task, when pressing the button.

Details of the new iOS4 multi-tasking can be found here:
http://developer.apple.com/iphone/library/documentation/iphone/conceptual/iphoneosprogrammingguide/BackgroundExecution/BackgroundExecution.html
#858
As an Apple Developer you can always upgrade to 4.0 for testing.

QuoteRegistered Apple Developers can access iOS SDK 4 for developing iPad, iPhone and iPod touch applications.

http://developer.apple.com/iphone/index.action

However, I'm not sure how difficult it is to revert back to 3.2.
#859
Announcements / Re: V8 beta
2010-Aug-13
QuoteAs soon as the value is put in a variable, all is okay...

By that, are you saying that this works?:

Code (glbasic) Select
LOCAL state%
state% = players[currentPlayer%].DisplayPointer(level,mouseBuffer)

SELECT state%
...
ENDSELECT
#860
Sounds like the value is going out of range.
Perhaps the iPhone is only 32bit, while a PC is 64bit?
2^31 = 2147483648, the max for a signed integer.

I found this in Google:
QuoteRAND_MAX is a constant defined in <cstdlib>. Its default value may vary between implementations but it is granted to be at least 32767.

Gernot, could this constant be changed either for all platforms, or for the iPhone only?
Just a thought, if that is the problem.
#861
You could try something like:

Code (glbasic) Select
FUNCTION GetKey%:
    LOCAL k% = 0
    IF KEY(52) = 1 THEN k=52
    IF KEY(79) = 1 THEN k=79
    IF KEY(80) = 1 THEN k=80
    IF KEY(82) = 1 THEN k=82
    RETURN k
ENDFUNCTION


Then you can use it in a SELECT statement like:
Code (glbasic) Select
SELECT GetKey()
CASE 52
...
CASE 80
...
ENDSELECT


This way you don't have unneeded key checks / if statements.
But, with SELECT statements you can't check for multiple checks, like is the player moving up AND shooting.

And yes, you can access variables inside INLINE and vise-versa.
Check the help file for 'INLINE' to get you started, or the forums for more specific help.
#862
Quotemuch quicker than our Unity mock up.

30,000 Poly's per second! Wow.
If I recall, Unity's limit is around 9,000 per second.
(Depending on various other details).
#863
You could try using the 'MOUSESTATE' command instead.
It uses absolute mouse coordinates, instead of relative / velocity.

That is of course if you what the object to follow your finger exactly, and not to push it in a direction.

[Edit]
Use with 'SETACTIVEMOUSE' to choose what finger to follow.
#864
That sounds easier, I've never used it.
I would have assumed that the 'debugger console' would only work when running in Simulation mode.
Nice to know.
#865
Here's a simple timer function that may help you:

Code (glbasic) Select
CONSTANT TIMER_UPDATE_PLAYER = 100 // Update the player every 100ms
LOCAL t_update_player% = TIMER_UPDATE_PLAYER // Initialize player timer

IF Timer(t_update_player, TIMER_UPDATE_PLAYER) = TRUE THEN
// Update player code
ENDIF

FUNCTION Timer%: BYREF time%, timer_length%
DEC time, GETTIMER()
IF time <= 0
time = timer_length // Reset timer
//time = timer_length-time // Reset timer  (Optional to above to prevent timer drifting)
RETURN TRUE    // Timer has ended
ELSE
RETURN FALSE      // Timer still executing
ENDIF
ENDFUNCTION


It automatically resets your timer variable too, one less thing to handle manually.
#866
Since it ends early, I'd start there.
It may also explain the black screen.

Write some logs to a file in the "DOCUMENTS" folder at various points in your code to see how far it makes it.
Do you have any device specific compiler directives (for the PC or iPhone)?
#867
Check out the second video in this forum post by 'Uncle':
http://www.glbasic.com/forum/index.php?topic=3265.0

He explains how to compile and set provision information and common problems you may encounter.
Plus, in one screen, I see a file called 'icon.png', so I assume this is the icon that is displayed on the iPhone.

I haven't yet compiled my game for the iPhone yet, been putting it off, as it sounds scary! ha.
Good luck.
#868
Quoted:\\glbasic

Is that just a typo (re: the extra "\")?
#869
That SPRCOLL check is saying:
"Will the player sprite, if it was at (x,y) collide with a terrain sprite if it was also at (x,y)"
That should always return true, since with that check both sprites would always be overlapping.

Sprites don't really exist/persist anywhere, think of them more as a BitBlt (blit) function.
Ie, to display them you just tell GLBasic to copy the bitmap to the screen at a certain location.
After that, the sprite doesn't exist at that position.

So, in general, the SPRCOLL check is asking:
"If I were to place sprite 1 at position x1, y1, would it collide with sprite 2 if I positioned it at x2, y2?"

So, you would need 25 SPRCOLL checks if you have 25 different terrain tiles.
If the terrain is in a tile map, a simple nested for loop (row, column) could be set up to check if the player would be colliding with each terrain tile.

#870
Quotesprcoll ([id_of_player], x_of_player, y_of_player, [id_of_terrain_sprite, x_of_player, y_of_player]))

Did you type that wrong, or did you mean for the 2nd 'x_of_player', 'y_of_player' to refer to the terrain, such as:

Code (glbasic) Select
SPRCOLL (player_id, player_x, player_y, terrain_id, terrain_x, terrain_y)

That should work.