Posted: 19th Aug 2011 17:07
Would anyone be interested in a community guide for AppGameKit?
Posted: 19th Aug 2011 17:38
the more information the better.
Posted: 19th Aug 2011 18:50
I think that would be appropriate and useful.
Posted: 22nd Aug 2011 13:45
The guys at TGC have given me the go ahead so what would you like to see in the guide?
Posted: 23rd Aug 2011 1:15
Hi Nickydude,

Firstly I wanted to thank you for the fantastic work you did with
The Official Community Guide to FPS Creator, I refer to it all of the time.

If the AppGameKit Community Guide could be similar, it would be great,I can only programme by looking at example code, like many others I expect.

Keep up the great work.
Posted: 23rd Aug 2011 1:32
Yes I badly need help!
Posted: 23rd Aug 2011 1:49
I would like to see tutorials on physics and networking (a huge focus spent on these two).

Also tutorials on how to use Xcode with Tier 1 and 2

Finally tutorials on level creation building and design.
Posted: 23rd Aug 2011 8:26
The community guide is what got me started in DBP and tought me most of the programing I know today. I would realy like to see one. Maybe not for me but for new people...
Posted: 23rd Aug 2011 20:40
Here's something for the community guide.

In Select/Case you can use Predefined Constants as opposed to Numbers. This is useful say for game flow and control.

+ Code Snippet
#constant menu 1
#constant game 2
#constant exit 3
game_state as integer = menu

select game_state

 case menu: 
 endcase

 case game:
 endcase

 case exit:
 endcase
endselect
Posted: 23rd Aug 2011 20:48
One important thing for game development is understanding the collision system used in AGK.

- How it works?
- Hit region types - square, etc....
- How to avoid multiple collisions in one event


I'm new to all that, and I'm having hard time to understand the details about it, and the implementation nuances...

Let me know how can I help. Maybe testing examples, etc?

Thanks for the initiative
Posted: 24th Aug 2011 6:14
yes, that would be great!! Nice one on the FPSC Guide. I feel that the AppGameKit guide should be more focused to certain thinks to keep a structure, as in the FPSC Guide there are a lot of info and very mixed, the most I liked was the FPI scripting language.

So if you can organize this kind of structure it would be great, thanks for your support!
Posted: 24th Aug 2011 22:06
Here's a tip for the guide...

Don't mess around too much with setup.agc!

I put in some extra comments listing all the resolutions I wanted to test, and my game got stuck in 320 x 480. I had to make a fresh version of the setup.agc file.

So, changing the window title, width, height, and full screen mode values works okay, but it's probably better to avoid doing anything else to the file.
Posted: 25th Aug 2011 18:44
And here's a code snippet for the Community Guide...

A Method For Drawing Lines

+ Code Snippet
SetVirtualResolution(1024, 768)

` The line start and end coordinates,
` using center screen as line start point.
x1# as float = 512.0
y1# as float = 384.0
x2# as float
y2# as float
lineWidth as Integer = 1
lineColorRed as Integer
lineColorGreen as Integer
lineColorBlue as Integer
lineColorAlpha as Integer = 255

` Load the one-pixel image, make a
` sprite from it, and position the sprite.
global pixelSpr
pixelImg = LoadImage("Pixel.png")
pixelSpr = CreateSprite(pixelImg)
SetSpritePosition(pixelSpr, x1#, y1#)

` Main program loop.
do
    if GetPointerReleased()
        x2# = GetPointerX()
        y2# = GetPointerY()
        lineColorRed = Random(0,255)
        lineColorGreen = Random(0,255)
        lineColorBlue = Random(0,255)
        lineWidth = Random(1,5)
        drawPixelLine(x1#, y1#, x2#, y2#, lineWidth, lineColorRed, lineColorGreen, lineColorBlue, lineColorAlpha)
    endif
    Sync()
loop

` Drawing the line.
function drawPixelLine(x1#, y1#, x2#, y2#, lineWidth, lineColorRed, lineColorGreen, lineColorBlue, lineColorAlpha)
    distance# as float
    angle# as float
    distance#=sqrt((x1#-x2#)^2+(y1#-y2#)^2)
    angle#=ATAN((y1#-y2#)/(x1#-x2#))
    if x2# <= x1# then angle# = angle# - 90.0 else angle# = angle# + 90.0
    SetSpriteSize(pixelSpr, lineWidth, distance#)
    SetSpriteOffset(pixelSpr, 0, distance#)
    SetSpritePositionByOffset(pixelSpr, x1#, y1#)
    SetSpriteAngle(pixelSpr, angle#)
    SetSpriteColor(pixelSpr, lineColorRed, lineColorGreen, lineColorBlue, lineColorAlpha)
endfunction


Most of the above code is just set-up, the function is all you need, as long as you pass it the required parameters. And you need a seperate sprite for each line.
Posted: 26th Aug 2011 0:54
Thanks Rich, much appreciated. You couldn't comment it further could you? Remember, this guide is for the absolute beginner (like me) and may not know what is meant by: "x2# = GetPointerX()", or "SetSpritePositionByOffset(pixelSpr, x1#, y1#)" for example.
Posted: 26th Aug 2011 1:42
Here's a version with lots 'o comments!

+ Code Snippet
SetVirtualResolution(1024, 768)

` The line start and end coordinates,
` using center screen as line start point.
` The line will be drawn from a point located
` at x1#,y1# on the screen to the point located
` at x2#,y2# on the screen.
x1# as float = 512.0
y1# as float = 384.0
x2# as float
y2# as float

` This determines how wide the line is.
lineWidth as Integer = 1

` This determines what color the line will be drawn with.
` Each color value can range from 0 to 255, with 0 being
` no intensity, and 255 being maximum intensity for that color.
` The three values (red, green, blue) are combined to make
` the final color.
lineColorRed as Integer
lineColorGreen as Integer
lineColorBlue as Integer

` This determines the transparency of the line, and can
` range from 0 (totally transparent) to 255 (totally opaque).
lineColorAlpha as Integer = 255

` Load the one-pixel image, make a sprite from it, and position the sprite.
` The variable pixelSpr is set to global because it is used by our function.
global pixelSpr

` The image should be a single white pixel. You can make this in MS Paint
` or any other drawing program. It can be a .png, .jpg, or .bmp format.
pixelImg = LoadImage("Pixel.png")

` This creates the sprite, using the loaded pixel image.
pixelSpr = CreateSprite(pixelImg)

` This locates the sprite at our starting coordinate.
SetSpritePosition(pixelSpr, x1#, y1#)

` Main program loop.
do
    
    ` This checks to see if the pointer has been clicked/pressed and then released.
    ` The pointer will be the mouse on a computer, or your finger on a tablet.
    if GetPointerReleased()

        ` This captures the screen coordinates of where the pointer was when it was released.
        x2# = GetPointerX()
        y2# = GetPointerY()

        ` This picks a random color for the line.
        lineColorRed = Random(0,255)
        lineColorGreen = Random(0,255)
        lineColorBlue = Random(0,255)

        ` This picks a random width for the line.
        lineWidth = Random(1,10)

        `This calls the function that resizes the pixel and points it at the pointer location.
        drawPixelLine(x1#, y1#, x2#, y2#, lineWidth, lineColorRed, lineColorGreen, lineColorBlue, lineColorAlpha)

    endif
    
    Sync()
    
loop

` Drawing the line. Note that this function as written only works for drawing one line/sprite. It would certainly
` be possible to put more lines on the screen, but this function only does one.
function drawPixelLine(x1#, y1#, x2#, y2#, lineWidth, lineColorRed, lineColorGreen, lineColorBlue, lineColorAlpha)

    ` Distance is from the first coordinate pair to the second pair.
    ` We'll use it determine how far we stretch the sprite.
    distance# as float

    ` Angle is the direction we point the sprite. The sprite points from
    ` the first coordinate pair to the second coordinate pair.
    angle# as float

    ` Calculate the distance.
    distance#=sqrt((x1#-x2#)^2+(y1#-y2#)^2)

    ` Calculate the angle, and adjust it to point correctly.
    angle#=ATAN((y1#-y2#)/(x1#-x2#))
    if x2# <= x1# then angle# = angle# - 90.0 else angle# = angle# + 90.0

    ` Stretch the sprite to have a width equal to our line width value,
    ` and a height equal to the distance between coordinate pairs.
    SetSpriteSize(pixelSpr, lineWidth, distance#)

    ` Offset the origin and position of the sprite to account for the stretching.
    SetSpriteOffset(pixelSpr, 0, distance#)
    SetSpritePositionByOffset(pixelSpr, x1#, y1#)

    ` Point the sprite at the target location.
    SetSpriteAngle(pixelSpr, angle#)

    ` And make the sprite match our color choice!
    SetSpriteColor(pixelSpr, lineColorRed, lineColorGreen, lineColorBlue, lineColorAlpha)
    
endfunction
Posted: 26th Aug 2011 1:53
That's awesome! You're becoming the guide's resident code guru Rich.
Posted: 28th Aug 2011 1:04
I'd like to see as much info as possible on tier 2 for xcode. Like adding native features (in-game purchasing, gamecenter).
Posted: 28th Aug 2011 2:30
For the moment the guide will focus on tier 1 on a Windows machine.
Posted: 30th Aug 2011 4:05
@MobileCreator. Sprite collision is fairly good. I posted about it awhile back thinking it was useless, but got some helpful answers off one of the devs. You can set it to either no shape(not tried this), box collision (pretty horrible in the main), spherical collision (more useable), and poly collision where it tries to draw a shape around your sprite (the best I have found to date). You set the collision by specifying a 0, 1, 2 or 3 flag for each in the setspriteshape(spriteid,flag) command.
As for checking for multiple hits you either hide your sprite when it is destroyed, and use the getspritevisible() command as a check, so it will ignore any other bullets, or set a flag to indicate if the enemy has been killed or not and use that,eg enemykilled[enemy]=0 (dead), and enemykilled[enemy]=1 (alive).

Edit- Oh, Rich Dersheimer, is that your pic in your avatar? If it is it has an uncanny resemblance to an adult movie star I have seen occasionally, and completely accidentally in the past :p
Posted: 30th Aug 2011 4:36
@DVader - yes, that's me.

completely accidentally


Riiiiiiight.