Scratchpad

Square Collision

'
x|---|x+tilesize
 |---|

y
|---|
|---|
y+tilesize
function SquareCollision( x, y, x2, y2, tilesize )
    Dim Collision
    Collision = 0
    If x + tilesize > x2 and x2 + tilesize > x Then Collision = Collision + 1
    If y + tilesize > y2 and y2 + tilesize > y Then Collision = Collision + 1
    If Collision = 2 then
        SquareCollision = true 
    Else
        SquareCollision = false
    End If
end function

Read / Data in FB

Dim names$(3)

For i = 1 to 3
    Read names$(i)
    Print "Just read " ; names$(i) ; " from the data list."
Next i
Sleep
End

Data "Tom", "Bob", "Meebo"

Struc

Struc Splayer
    pName$
    hitPoints
EndStruc

Dim Splayer player

player.pName$ = "Bob"
player.hitPoints = 100

Printr "Name : " ; player.pName$
Printr "HP   : " ; player.hitPoints

Mouse Test

dim tex
dim sprite1  

tex = LoadTexture("spaceship.bmp")
sprite1 = NewSprite(tex)

SprSetSize(32,32)
SprSetZOrder(1)

while true
BindSprite(sprite1)
SprSetPos(mouse_x()*windowwidth(),mouse_y()*windowheight())
printr sprX() + "-" + Mouse_x()*640
wend

BAGEL ANIMATION

dim animation(ImageStripFrames("animTest.jpg")-1)
animation = LoadImageStrip("animTest.jpg")

'Seperate frames into seperate animations.
dim walkAnim(3) '4 is the amount of frames, 4-1=3

walkAnim(0) = animation(0) '0 is the first image
walkAnim(1) = animation(1)
walkAnim(2) = animation(2)
walkAnim(3) = animation(3)

dim sprite
sprite = NewSprite(walkAnim)
SprSetPos(320,240) 

'Animation Loop

while true
SprSetTextures(walkAnim)
SprSetAnimSpeed(.5)
AnimateSprites()
WaitTimer(20)
wend
//where- yh and xh are the current x and y values of the lvl 2D array being checked
//in case you haven't guessed, lvl is the level layout :)

tile = 0;
            g = 0;
            while (wallUsed[g]) {
                g++;
            }
            if (lvl[yh - 1][xh] == 0) {
                tile += 1;
            }
            if (lvl[yh][xh + 1] == 0) {
                tile += 2;
            }
            if (lvl[yh][xh - 1] == 0) {
                tile += 4;
            }
            if (lvl[yh + 1][xh] == 0) {
                tile += 8;
            }
            wall[g] = attachMovie("wall" + tile,"wall", _root.getNextHighestDepth());

Preserved from the Main Page

Game Design News Featured Pages
October 08, Almost Midnight : Evil has returned. Beware. Beware. LISTEN TO ME!! IT'S PURE EVILLLEEE. Oh, it's just Grimdaze. Welcome back. :) :)

September 15 : New Tic-Tac-Toe sprite sheet released.

September 15 : Main page fixed. Sorry about that.

September 12 : The developer of CoolBasic, Zero, promises that "a new generation" is under development in his forum. See this CB forum post.

September 10 : GDN's front page gets a much needed makeover.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution 2.5 License.