Posted: 25th Aug 2011 0:40
Is there a problem with SetSpriteColor?

Whenever I do something like:
SetSpriteColor(playerSprite, 255,0,0,1)

My sprite doesn't show up on screen.

If I do this instead:
SetSpriteColorRed(playerSprite, 255)
SetSpriteColorGreen(playerSprite, 0)
SetSpriteColorBlue(playerSprite, 0)

Then it works.

However if I add the line:
SetSpriteColorAlpha(playerSprite, 1)

My sprite vanishes again, suggesting either there's a bug in how the alpha is set, or in my undertsanding of how the command works

Edit -> sorted! It was a bug in my undertsanding. I was expecting Alpha to go from 0 to 1, and it actually goes from 0 to 255.

You might want to add that info to the docs, as that little bit is missing. It just states:
iAlpha - The alpha component of the color. The acceptable range is from 0
Posted: 25th Aug 2011 3:36
@SPARTAN 31337 - if you are using tier 2, can you run the app and go to the "Debug->Break All" menu option when it gets to the busy mouse arrow and let me know what command it is stuck on?

But all works fine in Windows/Mac using the same code! No need to make 4 versions of the image there! The problem is only ios related


It will affect iOS and Bada, since those are the only platforms that actually rotate the screen during the running of the app. The fix probably still needs to be general case, since some Windows tablet may be supported in future or something.
Posted: 25th Aug 2011 9:31
SetSpriteColor(playerSprite, 255,0,0, 255)

Alpha ranges from 0 to 255.

If you put in 1 your sprite will be practically invisible!
Posted: 25th Aug 2011 9:58
Yeah, I figured it out (as per the edit to my post). But I'm used to wrking in the 0 to 1 range, and the fact the docs stopped short of explaining the range left me in the dark as much as my sprites!
Posted: 25th Aug 2011 12:14
Run the code I posted here. Lower() only returns the first character of a string, and converts numbers to letters!

+ Code Snippet
`Numbers get converted into text when used with Lower()
`ReadLine$ = "1234567890"

`Letters get truncated to the first letter with Lower()
ReadLine$ = "AbCdEfGhIj"

Key$ = "" : For Pos = 1 To 5 : Key$ = Key$ + Lower( Left( ReadLine$, Pos ) ) : Next Pos

Do
   Print( "        Original: " + ReadLine$ )
   Print( "          Left(): " + Left( ReadLine$, 5 ) )
   Print( "         Lower(): " + Lower( ReadLine$ ) )
   Print( "Lower() + Left(): " + Lower( Left( ReadLine$, 5 ) ) )
   Print( "       My Left(): " + Key$ )
   Sync()
Loop


See example image...


Also, when I first run it with the numbers, Lower displays 'e' if I move the mouse over it, it changes to 'v' (Or 'h' as in the screenshot)

Dude WTF! lol
Posted: 25th Aug 2011 18:08
Hi all,

I posted a problem I have with raycasting here it seems to me that it is a bug:
http://forum.thegamecreators.com/?m=forum_view&t=188586&b=41
Posted: 25th Aug 2011 20:37
The application will crash if you give the Val() function a blank string.


On a related note, reading lines (that don't exist) from a file will cause the application to crash. Example:

s$=ReadLine(1)

Edit: Same happens with 'ReadString'.

Trying to check for the end of the file to protect against this fails also. Example:

if FileEOF(1)=0 then s$=ReadLine(1)

This results in a 'BEX' crash error.

If the file has become corrupted and/or does not contain the line, the app crashes. Instead, a null value should be returned. It should not be required to check for the end of the file for each line anyway as that would add a lot of unnecessary redundant code in a variety of circumstances and for corrupted files, would return an invalid value anyway. So the language needs to be able to handle these situations without crashing.
Posted: 25th Aug 2011 21:32
Here's a new (small) bug:

In the tier 2 "Games - SpaceShooter" example for iOS (but not for OSX), in the "Aliens.mm" file, at line 23, we read:

void appt::Begin ( void )

when it should be:
void app::Begin ( void )

It won't compile if you don't change appt into app.

My two cents for now. I've just installed the package and am excitingly peeking here and there =)
Posted: 25th Aug 2011 23:22
Run the code I posted here. Lower() only returns the first character of a string, and converts numbers to letters!


Yep, I reported this one to Mike the first day of AGK's release, he replied telling me he fixed it .

For now you can use this "Lower$()" function I made:


+ Code Snippet
Function Lower$( text$ as string )
    newText$ = ""
    
    For i = 0 to Len( text$ )
        char$ = Mid( text$,i,1 )
        if Asc( char$ ) >= 65 and Asc( char$ ) <= 90
            newText$ = newText$ + chr( Asc( char$ ) + 32 )
        else
            newText$ = newText$ + char$
        endif
    Next i

Endfunction newText$



f FileEOF(1)=0 then s$=ReadLine(1)


Try using this function to get the amount of lines in the file:

+ Code Snippet
Function FileLength( file$ as string )
   lines = 0
   OpentoRead( 1,file$ )
      Repeat
         lines = lines + 1
         n$ = ReadLine( 1 )
      Until FileEOF( 1 ) = 1
   CloseFile( 1 )
   lines = lines - 1
Endfunction lines


If you loop through the file, and are using the "lines" value returned from this function, loop from 0 to "lines". For example

+ Code Snippet
fLines = FileLength( "myFile.txt" )

OpenToRead( 1,"myFile.txt" )
     For i = 0 to fLines
          line$ = ReadLine( 1 )
     Next i
CloseFile( 1 )
Posted: 26th Aug 2011 1:02
In my current game, I find commenting out large chunks of code causes an error if it's done in the main loop.

main.agc
+ Code Snippet
do
/*
lots
of
comments
here
*/
sync()
loop


Produces the error:
Could not understand command at line xxx.

Where xxx is the line that contains the /* mark to begin the comment section.
Posted: 26th Aug 2011 2:27
For now you can use this "Lower$()" function I made:

Fantastic! Thanks! It seams I'm spending most of my time re-writing core commands which should work, or re-creating IanM's plugin commands! (I wrote myself a split string function too! I'm well pleased! lol)
Posted: 26th Aug 2011 20:08
I'm seeing a problem using custom fonts and the program running on the app player, both for Mac and iPad. See the second and third posts in this thread for a view of what's happening.

EDIT:
I just tried it again on my Mac, and the font looks fine, so apparently the problem is only on my iPad. Since I'm using a player that I compiled myself, it's entirely possible that I did it wrong, and the actual AppGameKit player made by TGC could very well have no problem at all with this.
Posted: 26th Aug 2011 22:56
Not sure if it's already been mentioned, but despite being in the help file, INC and DEC are not recognised commands.
Posted: 26th Aug 2011 23:23
Umm, yes they are.

try this...

+ Code Snippet
do
    temp = 0

    for x = 1 to 10
        INC temp
        print(temp)
    next x

    for x = 1 to 10
        DEC temp, 2
        print(temp)
    next x

    Sync()
loop


Compiles and runs just fine for me. How are you using them?
Posted: 27th Aug 2011 0:12
Hmm, bizarre. I closed AppGameKit down for a while, and now it's working but the commands aren't highlighted.

Wonder if there's something else a bit odd going on...

Edit -> No, it's still not working right. These two lines of code are in a function in an included file in my project:
+ Code Snippet
rocks[i].angle# = rocks[i].angle# + rocks[i].rotationSpeed#

inc rocks[i].angle#, rocks[i].rotationSpeed#

As far as I can tell, they should be functionaly equivalent, but when I only use the inc line, angle# isn't incremented. When I use the long winded method, angle# is increased just fine. Maybe it's an issue using it in conjunction with an array element?
Posted: 27th Aug 2011 19:01
GetWritePath() is returning a null string when run on the windows player. Also, the help file entry for it is mixed up with the DeleteFile() help entry.
Posted: 27th Aug 2011 20:46
Just started using AppGameKit and setup a basic Project to start with.

I rem'ed out Print("hello world") just as a test but it wont update my change. Keeps printing "hello world"

What am I doing wrong?
Posted: 27th Aug 2011 20:49
Scope for Variables seems to not be working as intended. For example, declaring a variable inside main.agc outside of a function does not make it automatically global, you have to declare it as global.
Posted: 29th Aug 2011 2:05
As far as I can tell, they should be functionaly equivalent, but when I only use the inc line, angle# isn't incremented. When I use the long winded method, angle# is increased just fine. Maybe it's an issue using it in conjunction with an array element?


No, I'm getting the same craziness. I think it's when using Inc with floats.
Posted: 29th Aug 2011 6:10
@Paul

This is Tier 1, not 2. The app just locks up.

I fixed it by giving up AppGameKit on the work laptop and installing it on my home PC, where it works fine.

The home PC is Win7 x64 with 8GB also, however it only has 1 video card and the laptop has 2 (wierd, yes I know).