Here are the entries:
That1Smart Guy
sync on : randomize timer()
New_Game:
set text size 15
gosub init_stuff
gosub menu
gosub Main_Game
gosub Target_Round
gosub Mirror_Round
if score>100 then gosub Bonus_Round
gosub Game_Over
end
`-------------------------------------------------
`SUBROUTINES
`-------------------------------------------------
init_stuff:
score=0
ink rgb(255,0,0),0
for x=0 to 49
for y=0 to 49
if distance#(x,y,25,25)<=20
dot x,y
endif
next y
next x
get image 1,0,0,50,50
cls
ink rgb(0,255,0),0
for x=0 to 49
for y=0 to 49
if distance#(x,y,25,25)<=20
dot x,y
endif
next y
next x
get image 2,0,0,50,50
cls
ink rgb(0,0,255),0
for x=0 to 49
for y=0 to 49
if distance#(x,y,25,25)<=20
dot x,y
endif
next y
next x
get image 3,0,0,50,50
cls
return
menu:
ink rgb(255,255,255),0
center text 320,50,"The goal of this game is to click as many dots as possible"
ink rgb(255,0,0),0
center text 320,100,"Red dots need to be left clicked on"
ink rgb(0,255,0),0
center text 320,150,"Green dots need to be right clicked"
ink rgb(0,0,255),0
center text 320,200,"Blue dots need to be clicked with both left and right mouse buttons"
ink rgb(255,255,255),0
center text 320,250,"You will have 60 seconds to click as many as possible"
wait 2000
center text 320,320,"Click to begin"
repeat
sync
until mouseclick()=1
cls
return
Game_Over:
cls 0
ink rgb(255,255,255),0
set text size 40
center text 320,200,"FINAL SCORE -- "+str$(score)
center text 320,400,"Click for new game"
wait 2000
repeat
sync
until mouseclick()=1
goto New_Game
return
Main_Game:
T=Timer()
ink rgb(255,255,255),0
set text opaque
do
x=rnd(590) : y=rnd(430) : clicktype=rnd(2)+1
paste image clicktype,x,y,1
repeat
text 10,10, str$(600-((timer()-T)/100))
text 550,10,"Score - "+str$(score)
sync
if 600-((timer()-T)/100)<=0 then exit
until mouseclick()=clicktype and circlemouseover(x+25,y+25,20)=1
inc score
cls
if 600-((timer()-T)/100)<=0 then exit
loop
cls
return
Target_Round:
set text size 30
center text 320,200,"Target Round!!!"
center text 320,250,"HIT AS MANY TARGETS"
center text 320,290,"AS YOU CAN!!"
sync
wait 1500
cls
dim bonus(108,2)
b=0
for x=0 to 590 step 50
for y=0 to 430 step 50
bonus(b,1)=x
bonus(b,2)=y
bonus(b,0)=rnd(2)+1
inc b
next y
next x
set text size 15
T=timer()
repeat
for b=0 to 96
if bonus(b,0)>0
paste image bonus(b,0),bonus(b,1),bonus(b,2)
endif
next b
if mouseclick()>0
mc=mouseclick() : mx=mousex() : my=mousey()
for b=0 to 108
if bonus(b,1)<mx and mx<bonus(b,1)+40
if bonus(b,2)<my and my<bonus(b,2)+40
if bonus(b,0)>0
if mc=bonus(b,0) and clickflag=0
bonus(b,0)=0
inc score
clickflag=1
endif
endif
endif
endif
next b
else
clickflag=0
endif
center text 320,10,"SCORE - "+str$(score)
text 10,10, str$(150-((timer()-T)/100))
sync
cls
until 150-((timer()-T)/100)<=0
return
Mirror_Round:
set text size 20
center text 320,200,"Mirror Round!!!"
center text 320,240,"Click on the mirror where the dot should be"
ink rgb(100,100,255),0
box 320,300,639,479
paste image 1,150,400
ink 0,0
line 465,425,480,430
line 465,425,455,440
line 480,430,455,440
line 467,435,470,438
sync
wait 3000
cls
T=Timer()
set text size 15
set text opaque
do
ink rgb(100,100,255),0
box 320,0,639,479
ink rgb(255,255,255),0
x=rnd(270)+340 : y=rnd(430) : clicktype=rnd(2)+1
paste image clicktype,270-(x-320),y,1
repeat
text 10,10, str$(300-((timer()-T)/100))
text 550,10,"Score - "+str$(score)
sync
if 300-((timer()-T)/100)<=0 then exit
until mouseclick()=clicktype and circlemouseover(x+25,y+25,40)=1
inc score
cls
if 300-((timer()-T)/100)<=0 then exit
loop
return
Bonus_Round:
ink rgb(255,255,255),0
set text size 20
center text 320,200,"BONUS ROUND!!!"
center text 320,280,"HIT THE TARGET!!!"
wait 1500
cls rgb(0,255,0)
colorflag=0
for rad=50 to 10 step -10
if colorflag=0
ink rgb(255,0,0),0
else
ink rgb(255,255,255),0
endif
if rad=10 then ink rgb(0,0,255),0
for x=50-rad to 50+rad
for y=50-rad to 50+rad
if distance#(50,50,x,y)<=rad then dot x,y
next y
next x
colorflag=abs(colorflag-1)
next rad
get image 5,0,0,100,100
cls 0
make object plain 1,10,10
`ghost object on 1
texture object 1,5
xrotate object 1,90
make object plain 2,500,500
color object 2,rgb(0,255,0)
xrotate object 2,90
position object 2,0,-5,0
position camera 0,50,-50
xrotate camera 90
camz=-50
repeat
inc camz
position camera 0,50,camz
if mouseclick()=1 then Fire=1 : exit
sync
until camz>60
if Fire=1
mx=mousex() : my=mousey()
colorhit=point(mx,my)
if colorhit < (256*256*255)+20
if colorhit<256
rem you hit blue (bullseye)
inc score, 30
else
rem you hit red
inc score, 10
endif
else
rem you hit white
inc score,20
endif
endif
delete object 1 : delete object 2
backdrop off
return
`---------------------------------------------------
`FUNCIONS
`---------------------------------------------------
function circlemouseover(x,y,rad)
mx=mousex() : my=mousey()
dist#=distance#(mx,my,x,y)
if dist#<=rad then exitfunction 1
endfunction 0
function distance#(x1,y1,x2,y2)
dist#=sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1)))
dist#=abs(dist#)
endfunction dist#
Phaelax
REM Challenge: Target Hitting
REM Author: Phaelax
set display mode 800,600,32
sync on
tilt# = 90
power# = 0.0
g# = 6.6
a# = 300
originX = 600
originY = 490
level = 1
repeat
cls
gosub Controls:
drawScene()
gosub drawMeter
drawArcher(originX, originY+60, power#, tilt#)
drawStupidGuy(725,570)
gosub fireArrow
gosub checkResults
rem draw arrow
ink rgb(0,0,255),0
line originX+x, originY-y, originX+x+sin(a#)*20, originY-y+cos(a#)*20
rem if player beats a level, pause for 2 seconds before continuing
if win = 1
if timer() - timestamp >= 2000
originX = originX - 40
x = x + 40
inc level, 1
win = 0
appleHit = 0
endif
endif
set cursor 20,20
print "Power: ", power#*100
print "Tilt: ", tilt#
print
print "Level: ", level
sync
until returnkey()
end
checkResults:
gameover = 0
ink rgb(255,255,255),0
if gameover = 0
if appleHit = 1
center text 400, 100, "You hit the apple!"
if bodyHit = 1
center text 400, 120, "Unfortunately, you also annihilated your buddy"
ink rgb(255,0,0),0
center text 400, 200, "GAME OVER"
gameover = 1
else
center text 400, 120, "Congratulations, step back 10 paces and try 'his' luck again!"
if win = 0 then timestamp = timer()
win = 1
endif
else
if bodyHit = 1
center text 400, 120, "NO no no! The apple! Hit the apple!"
ink rgb(255,0,0),0
center text 400, 200, "GAME OVER"
gameover = 1
endif
endif
endif
if gameover = 1
center text 400, 240, "Would you like to try again? (Y/N)"
if k = 21
level = 1
originX = 600
appleHit = 0
bodyHit = 0
endif
if k = 49 then end
endif
RETURN
Controls:
if gameover = 1 then k = scancode()
if mouseclick() = 1 and mFlag = 0
mFlag = 1
oldX = originX
oldY = originY
endif
if mouseclick() = 1 and mFlag = 1
dx = (mousex() - oldX)
dy = (mousey() - oldY)
d2 = dx*dx + dy*dy
if d2 > 16
power# = d2 / 10000.0
if power# > 1 then power# = 1
else
power# = 0
endif
tilt# = atanfull(dx, dy)*-1
if tilt# < 0 then tilt# = 0
if tilt# > 90 then tilt# = 90
endif
if mouseclick() = 0
if mFlag = 1
mFlag = 0
if power# > 0
fire = 1
t# = 0
v# = 120 * power#
rem 750 is the x-axis we want to find the impact at
impact_time# = (750-originX)/(sin(tilt#)*v#)
preX = originX
preY = originY
appleHit = 0
bodyHit = 0
endif
endif
endif
RETURN
drawMeter:
if mFlag = 1
ink rgb(0,255,0),0
circle originX, originY, 4
circle originX, originY,100
ink rgb(64,255,64),0
d# = sqrt(d2)
if d# > 100 then d# = 100
line originX, originY, originX+sin(180+tilt#)*d#, originY-cos(180+tilt#)*d#
endif
RETURN
fireArrow:
if fire = 1
t# = t# + 0.2
if t# >= impact_time#
t# = impact_time#
fire = 0
endif
x = sin(tilt#)*v#*t#
y = cos(tilt#)*v#*t# - 0.5*g#*t#^2
feet = ((600-(originY-y)+20)/360.0)*180
if originY-y > 600 then fire = 0
ink rgb(0,0,255),0
circle originX+x, originY-y, 2
a# = wrapvalue(atanfull(x-preX, y-preY)+180)
lx1 = originX + x
ly1 = originY - y
lx2 = lx1 + sin(a#)*20
ly2 = ly1 + cos(a#)*20
line lx1, ly1, lx2, ly2
preX = x
preY = y
rem apple is: (circle 725, 476, 4)
i = lx2 - lx1
j = ly2 - ly1
n# = ((725 - lx1)*i) + ((476 - ly1)*j)
d# = i*i + j*j
u# = n# / d#
if u# >= 0 and u# <= 1
ix# = lx1 + (lx2 - lx1)*u#
iy# = ly1 + (ly2 - ly1)*u#
e = 725 - ix#
f = 476 - iy#
dist = e*e + f*f
if dist <= 36 then appleHit = 1 : r = dist
endif
rem bounding ellipse around target guy (ellipse x, y-45, 15,45), where [x,y] is stupidGuy position
ex# = 725 / 15.0
ey# = 525 / 45.0
px# = (originX + x) / 15.0
py# = (originY - y) / 45.0
dist# = (ex# - px#)^2 + (ey# - py#)^2
if dist# <= 1.0
bodyHit = 1
endif
endif
RETURN
function drawScene()
rem floor
gradientVerticalBox(0,500,799,599,rgb(36,36,36),rgb(48,96,96))
rem measuring wall
for x = 0 to 40
rem wall
ink rgb(200,200,200),0
box 730+x, 200+x, 730+x, 550+x
rem shadow
ink rgb(64,64,64),0
box 730+x, 550+x, 799, 550+x
next x
rem wall top
ink rgb(128,128,128),0
for i = 1 to 10
line 730+i, 200, 770+i, 240
next i
rem wall side
box 770,240,780,590
rem foot markings
ink rgb(92,92,92),0
for i = 0 to 17
y = 240+i*20
line 730, 200+i*20, 770, y
line 770, y, 780, y
feet$ = str$((18-i)*10)
`if len(feet$) < 3 then feet$ = " "+feet$
text 782,y-8, feet$
next i
endfunction
function drawStupidGuy(x, y)
ink rgb(255,203,179),0
circle x, y-80, 10
line x, y-70, x, y-30
rem legs
line x, y-30, x-20, y
line x, y-30, x+20, y
rem arms
line x-15, y-35, x,y-55
line x+15, y-35, x,y-55
rem apple
ink rgb(255,0,0),0
circle x, y-94, 4
circle x, y-94, 3
circle x, y-94, 2
ellipse x, y-45, 15,45
endfunction
function drawArcher(x, y, power#, tilt#)
ink rgb(255,203,179),0
circle x, y-80, 10
line x, y-70, x, y-30
rem legs
line x, y-30, x-20, y
line x, y-30, x+20, y
rem point of hand on bow
x2 = sin(tilt#)*30
y2 = cos(tilt#)*30
handX = x+x2
handY = (y-60)-y2
line x, y-60, handX, handY
rem the ends of the bow
bx1 = x+x2 + sin(tilt#-90)*20
by1 = (y-60)-y2 + cos(tilt#-90)*20
bx2 = x+x2 + sin(tilt#+90)*20
by2 = (y-60)-y2 + cos(tilt#+90)*20
rem arm pulling on bow string
p = power#*20+4
ax = 15-p
ay = 5*power#
bx = 30-p
by = 0
px = x + bx*sin(tilt#)
py = (y-60) + -1*bx*cos(tilt#)
elbowX = x + ax*sin(tilt#) + ay*cos(tilt#)
elbowY = (y-58) + -1*ax*cos(tilt#) + ay*sin(tilt#)
line x, y-58, elbowX, elbowY
line elbowX, elbowY, px, py
rem bow
ink rgb(84,45,1),0
line bx1, by1, bx2, by2
ink rgb(255,255,255),0
rem bow string
for i = 20 to 36
eAngle = i*10
lx = sin(eAngle)*p
ly = cos(eAngle)*20
lx1 = handX + lx*sin(tilt#) + ly*cos(tilt#)
ly1 = handY + -1*lx*cos(tilt#) + ly*sin(tilt#)
line bx1, by1, lx1, ly1
bx1 = lx1
by1 = ly1
next i
endfunction
REM **************************************************
REM Draws a box with a vertical gradient
REM **************************************************
function gradientVerticalBox(left,top,right,bottom,color1,color2)
height#=bottom-top
for y=top to bottom-1
t# = (y-top) / height#
ink getTransitionalColor(color1,color2,t#),0
box left,y,right,y+1
next y
endfunction
REM **************************************************
REM Returns a linear interpolated color between base
REM color and target color. Percent ranges from 0 to 1
REM **************************************************
function getTransitionalColor(base, target, percent#)
br = rgbr(base)
bg = rgbg(base)
bb = rgbb(base)
tr = rgbr(target)
tg = rgbg(target)
tb = rgbb(target)
tr = br + (tr-br)*percent#
tg = bg + (tg-bg)*percent#
tb = bb + (tb-bb)*percent#
color = rgb(tr,tg,tb)
endfunction color
Ashingda 27
REM **************************
REM * DBC Challenge, Targets *
REM **************************
set display mode 640,480,32
create bitmap 1,640,480
sync on
sync rate 80
randomize timer
gosub Innitialize
State$ = ""
do
if State$ = "" then gosub MainMenu
if State$ = "StartNewGame" then gosub StartNewGame
if State$ = "Game" then gosub Game
if State$ = "GameMenu" then gosub GameMenu
if State$ = "GameWin" then gosub GameWin
if State$ = "GameOver" then gosub GameOver
ink rgb(255,255,255),0
text 0,0,"FPS: "+str$(screen fps())
`text 0,20,"Time: "+str$(TimeLine)
copy bitmap 1,0
sync
cls
loop
Innitialize:
gosub LoadConstants
gosub LoadGlobals
gosub LoadArrays
gosub LoadMemblocks
gosub LoadImages
gosub LoadData
return
LoadConstants:
`Ashingda - Memblock Constants
MEM_BUFFER1 = 1
MEM_BUFFER2 = 2
MEM_IMAGE_BUFFER16x16 = 3
MEM_IMAGE_TILE_BUFFER32x32 = 4
MEM_COLLISION = 5
`Ashingda - Image Constants
IMG_PLAYER = 1001
IMG_ENEMY = 1002
IMG_BOSS = 1003
IMG_SHOT_PLAYER = 1011
IMG_SHOT_ENEMY = 1012
IMG_BOMB_PLAYER = 1013
IMG_SHOT_POWERUP = 1014
IMG_BOMB_POWERUP = 1015
IMG_TILE_WATER = 2001
`Ashingda - Array Constants
MAX_PROJECTILE_ID = 100
MAX_ENEMY = 25
MAX_POWERUP = 2
`Ashingda - Weapon Constants
WEP_SHOT_PLAYER = 0
WEP_SHOT_ENEMY = 1
WEP_BOMB_PLAYER = 2
`Ashingda - PowerUp Constants
POW_SHOT = 1
POW_BOMB = 2
return
LoadGlobals:
`Ashingda - Setup Global Mouse variables
dim mx(0)
dim my(0)
dim mc(0)
dim click(0)
return
LoadArrays:
`Ashingda - Custome Image Data Arrays
dim PaletteColor(9)
dim Data$(4)
`Ashingda - All Projectiles Array
dim ProjectileID(MAX_PROJECTILE_ID)
dim ProjectileImage(MAX_PROJECTILE_ID)
dim ProjectileType(MAX_PROJECTILE_ID)
dim ProjectileFlag(MAX_PROJECTILE_ID)
dim ProjectileDirectionX#(MAX_PROJECTILE_ID)
dim ProjectileDirectionY#(MAX_PROJECTILE_ID)
dim ProjectileX#(MAX_PROJECTILE_ID)
dim ProjectileY#(MAX_PROJECTILE_ID)
`Ashingda - Waypoint or AI Arrays
dim WayPointX(10,3)
dim WayPointY(10,3)
dim Map(20,2)
`Ashingda - Enemy Arrays
dim EnemyID(MAX_ENEMY)
dim EnemyAI(MAX_ENEMY)
dim EnemyDelay(MAX_ENEMY)
dim EnemyX#(MAX_ENEMY)
dim EnemyY#(MAX_ENEMY)
dim EnemyMoveX#(MAX_ENEMY)
dim EnemyMoveY#(MAX_ENEMY)
dim EnemyTravel(MAX_ENEMY)
`Ashingda - Exlposion Effect Arrays
dim ExplosionID(100)
dim ExplosionX(100)
dim ExplosionY(100)
dim ExplosionS(100)
dim ExplosionSpeed(100)
`Ashingda - PowerUp Arrays
dim PowerUpID(MAX_POWERUP)
dim PowerUpType(MAX_POWERUP)
dim PowerUpImage(MAX_POWERUP)
dim PowerUpX#(MAX_POWERUP)
dim PowerUpY#(MAX_POWERUP)
dim PowerUpDrX#(MAX_POWERUP)
dim PowerUpDrY#(MAX_POWERUP)
return
LoadMemblocks:
`Ashingda - Memblock used for Tile creation.
make memblock MEM_IMAGE_BUFFER16x16,12+(16+16*16)*4
write memblock dword MEM_IMAGE_BUFFER16x16,0,16
write memblock dword MEM_IMAGE_BUFFER16x16,4,16
write memblock dword MEM_IMAGE_BUFFER16x16,8,32
`Ashingda - Memblock used for Tile creation.
make memblock MEM_IMAGE_TILE_BUFFER32x32,12+(32+32*32)*4
write memblock dword MEM_IMAGE_TILE_BUFFER32x32,0,32
write memblock dword MEM_IMAGE_TILE_BUFFER32x32,4,32
write memblock dword MEM_IMAGE_TILE_BUFFER32x32,8,32
return
LoadImages:
`Ashingda - Water Tile Creation 32x32 pixel image
for lpy = 0 to 31
for lpx = 0 to 31
pos = 12+(lpx+lpy*32)*4
`Ashingda - Setting up the random water colors
b = rnd(50)+205
g = rnd(50)+100
r = g
`Ashingda - Writing to Memblock
write memblock byte MEM_IMAGE_TILE_BUFFER32x32,pos,b
write memblock byte MEM_IMAGE_TILE_BUFFER32x32,pos+1,g
write memblock byte MEM_IMAGE_TILE_BUFFER32x32,pos+2,r
next lpx
next lpy
`Ashingda - Creating the Image from the Memblock
make image from memblock IMG_TILE_WATER,MEM_IMAGE_TILE_BUFFER32x32
`Ashingda - Player Image Creation
Data$(0) = "0,16711680,65280,255,16776960,65535,16711935,10197760,16777215,657930,"
Data$(1) = "0000000000000000000000000000000000000000000000000000000990000000"
Data$(2) = "0000009889000000000000935900000000000095390000000000009849000000"
Data$(3) = "0090098488900900091998884889919009498884888894900985888848885890"
Data$(4) = "9858587487858589958589944998585995589091190985599999000990009999"
`Ashingda - Create the Image using the Data$()
CreateImage(IMG_PLAYER,MEM_IMAGE_BUFFER16x16)
`Ashingda - Sizing the Image to 200%
SizeImage(IMG_PLAYER,200)
`Ashingda - Enemy Image Creation
Data$(1) = "0000099999900000000098181189000000009811818900000000099819900000"
Data$(2) = "0000009189000000000000981900000000999991899999000988889819888890"
Data$(3) = "9811119189111189981111981911118909888891898888900099999819999900"
Data$(4) = "0000009539000000000000935900000000000098890000000000000990000000"
`Ashingda - Create the Image using the Data$()
CreateImage(IMG_ENEMY,MEM_IMAGE_BUFFER16x16)
`Ashingda - Sizing the Image to 200%
SizeImage(IMG_ENEMY,200)
`Ashingda - BOSS Image Creation
Data$(1) = "0999999999999990092222685622229009666668566666900099999999999900"
Data$(2) = "0000009859000000000000985900000000000968569000009999996856999990"
Data$(3) = "9222226856222229926262685626262996666695596666690969991991999690"
Data$(4) = "0919095665909190009009611690090000000916619000000000009999000000"
`Ashingda - Create the Image using the Data$()
CreateImage(IMG_BOSS,MEM_IMAGE_BUFFER16x16)
`Ashingda - Sizing the Image to 400%
SizeImage(IMG_BOSS,400)
`Ashingda - Player Shot Image Creation
Data$(1) = "0099900000000000094449000000000004444400000000000444440000000000"
Data$(2) = "0444440000000000094449000000000009444900000000000044400000000000"
Data$(3) = "0094900000000000000400000000000000949000000000000004000000000000"
Data$(4) = "0009000000000000000400000000000000090000000000000004000000000000"
`Ashingda - Create the Image using the Data$()
CreateImage(IMG_SHOT_PLAYER,MEM_IMAGE_BUFFER16x16)
`Ashingda - Enemy Shot Image Creation
Data$(1) = "0000000000000000000000000000000000000000000000000000000000000000"
Data$(2) = "0000000000000000000000000000000000099900000000000095559000000000"
Data$(3) = "0095559000000000009555900000000000099900000000000000000000000000"
Data$(4) = "0000000000000000000000000000000000000000000000000000000000000000"
`Ashingda - Create the Image using the Data$()
CreateImage(IMG_SHOT_ENEMY,MEM_IMAGE_BUFFER16x16)
`Ashingda - Player Bomb Image Creation
Data$(1) = "0009000000000000009190000000000000999000000000000098900000000000"
Data$(2) = "0098900000000000009890000000000009989900000000009598959000000000"
Data$(3) = "9596959000000000999999900000000000000000000000000000000000000000"
Data$(4) = "0000000000000000000000000000000000000000000000000000000000000000"
`Ashingda - Create the Image using the Data$()
CreateImage(IMG_BOMB_PLAYER,MEM_IMAGE_BUFFER16x16)
`Ashingda - Sizing the Image to 200%
SizeImage(IMG_BOMB_PLAYER,200)
`Ashingda - SHOT PowerUp Image Creation
Data$(1) = "0000009999900000000000988890000000000099999000000000094414490000"
Data$(2) = "0000094111490000000009441449000000000099999000000000009888900000"
Data$(3) = "0000009999900000000000000000000000000000000000008000808888088880"
Data$(4) = "8000808000080008800080888808888080808080000800008808808888080000"
`Ashingda - Create the Image using the Data$()
CreateImage(IMG_SHOT_POWERUP,MEM_IMAGE_BUFFER16x16)
`Ashingda - BOMB PowerUp Image Creation
Data$(1) = "0000000090000000000000091900000000000009990000000000000989000000"
Data$(2) = "0000000989000000000000098900000000000099899000000000095989590000"
Data$(3) = "0000095969590000000009999999000000000000000000008800080080080880"
Data$(4) = "8080808088880808880080808008088080808080800808088800080080080880"
`Ashingda - Create the Image using the Data$()
CreateImage(IMG_BOMB_POWERUP,MEM_IMAGE_BUFFER16x16)
return
LoadData:
`Ashingda - Loads the AI data
Data$(0) = "205,1,214,347,81,254,338,0,351,359,463,247,82,163,189,98,"
Data$(1) = "461,95,82,282,271,179,463,166,234,3,239,162,84,475,272,0,"
Data$(2) = "278,296,276,478,305,2,313,198,461,478,82,3,300,177,462,"
Data$(3) = "479,263,4,115,112,416,113,"
Data$(4) = ""
LoadAI()
`Ashingda - Loads the Map data
Data$(0) = "123340340005340008567567567004840840840000123123457680605040900"
LoadMap()
return
MainMenu:
Gosub HandleKeys
`Ashingda - Blue Box
ink rgb(150,200,255),0
box 50,50,640-50,480-50
`Ashingda - Green Box
ink rgb(150,255,200),0
box 280,150,640-80,480-80
`Ashingda - Red Box
ink rgb(255,220,220),0
box 140,200,640-300,480-120
`Ashingda - Drawing the Tile
set text size 50
ink 0,0
text 70-1,50-1,"Ashingda's Entry"
ink rgb(255,255,255),0
text 70,50,"Ashingda's Entry"
set text size 30
ink 0,0
text 70-1,150-1,"1945 Clone"
ink rgb(255,255,255),0
text 70,150,"1945 Clone"
set text size 10
`Ashingda - StartGame Menu
if Menu("Start Game",400,300)
if click(0) = 0
State$ = "StartNewGame"
endif
endif
`Ashingda - Exit Game Menu
if Menu("Exit Game",400,330)
if click(0) = 0
end
endif
endif
return
StartNewGame:
`Ashingda - Reseting all the Variables for new game
PlayerX# = 80 + 11*16
PlayerY# = 480-32
PlayerSpeed# = 2
State$ = "Game"
StartTime = timer()
TimeLine = (timer()-StartTime)/2000
OldTime = -1
Score = 0
Health = 10
GameWin = 0
GameLoose = 0
Bombs = 5
PlayerWep = 1
hide mouse
`Ashingda - Clear the Arrays
for lp = 0 to MAX_PROJECTILE_ID
ProjectileID(lp) = 0
next lp
for lp = 0 to MAX_POWERUP
PowerUpID(lp) = 0
next lp
for lp = 0 to MAX_ENEMY
EnemyID(lp) = 0
next lp
return
Game:
gosub HandleKeys
gosub HandleBackGround
gosub HandlePlayer
gosub HandleEnemy
gosub HandleProjectile
gosub HandlePowerUp
gosub HandleDisplay
return
HandleKeys:
mx(0) = mousex()
my(0) = mousey()
mc(0) = mouseclick()
if mc(0) = 0
click(0) = 0
endif
if returnkey()
State$ = "GameMenu"
show mouse
endif
return
HandleBackGround:
`Ashingda - This variable is used to offset the Water Tiles
if ScrollWaterY < 0
ScrollWaterY = ScrollWaterY + 1
else
ScrollWaterY = -32
endif
return
HandlePlayer:
`Ashingda - Flags the GameOver if Health drops to zero
if Health < 1 then State$ = "GameOver"
`Ashingda - Arrow Keys
if leftkey() then PlayerX# = PlayerX# - PlayerSpeed#
if rightkey() then PlayerX# = PlayerX# + PlayerSpeed#
if upkey() then PlayerY# = PlayerY# - PlayerSpeed#
if downkey() then PlayerY# = PlayerY# + PlayerSpeed#
`Ashingda - Out of Bounce Check
if PlayerX# < 96 then PlayerX# = 96
if PlayerX# > 416 then PlayerX# = 416
if PlayerY# < 16 then PlayerY# = 16
if PlayerY# > 464 then PlayerY# = 464
`Ashingda - Key "1" for SHOT
if keystate(2)
if PlayerShotDeley = 0
`Ashingda - Creating the Shot
PlayerShotDeley = 12
LoopID = MAX_PROJECTILE_ID
Image = IMG_SHOT_PLAYER
Type = WEP_SHOT_PLAYER
Flag = 0
DirX# = 0
DirY# = -6
X# = PlayerX#
Y# = PlayerY#
gosub PlayerWeapon
endif
endif
`Ashingda - Key "2" for BOMB
if keystate(3)
if PlayerBombDeley = 0 and Bombs > 0
Bombs = Bombs - 1
`Ashingda - Creating the Bomb
PlayerBombDeley = 32
LoopID = MAX_PROJECTILE_ID
Image = IMG_BOMB_PLAYER
Type = WEP_BOMB_PLAYER
Flag = 0
DirX# = 0
DirY# = -6
X# = PlayerX#
Y# = PlayerY#
CreateProjectile(LoopID,Image,Type,Flag,DirX#,DirY#,X#,Y#)
endif
endif
`Ashingda - Decrease Delay
if PlayerShotDeley > 0 then PlayerShotDeley = PlayerShotDeley - 1
if PlayerBombDeley > 0 then PlayerBombDeley = PlayerBombDeley - 1
return
PlayerWeapon:
b# = .25
if PlayerWep = 1
CreateProjectile(LoopID,Image,Type,Flag,DirX#,DirY#,X#,Y#)
endif
if PlayerWep = 2
CreateProjectile(LoopID,Image,Type,Flag,DirX#-b#,DirY#,X#-3,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#+b#,DirY#,X#+3,Y#)
endif
if PlayerWep = 3
CreateProjectile(LoopID,Image,Type,Flag,DirX#-b#,DirY#,X#-8,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#,DirY#,X#,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#+b#,DirY#,X#+8,Y#)
endif
if PlayerWep = 4
CreateProjectile(LoopID,Image,Type,Flag,DirX#-b#,DirY#,X#-10,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#-b#,DirY#,X#-2,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#+b#,DirY#,X#+2,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#+b#,DirY#,X#+10,Y#)
endif
if PlayerWep = 5
CreateProjectile(LoopID,Image,Type,Flag,DirX#-b#,DirY#,X#-16,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#-b#,DirY#,X#-8,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#,DirY#,X#,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#+b#,DirY#,X#+8,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#+b#,DirY#,X#+16,Y#)
endif
if PlayerWep = 6
CreateProjectile(LoopID,Image,Type,Flag,DirX#-b#,DirY#,X#-18,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#-b#,DirY#,X#-10,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#-b#,DirY#,X#-2,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#+b#,DirY#,X#+2,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#+b#,DirY#,X#+10,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#+b#,DirY#,X#+18,Y#)
endif
if PlayerWep => 7
CreateProjectile(LoopID,Image,Type,Flag,DirX#-b#,DirY#,X#-24,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#-b#,DirY#,X#-16,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#-b#,DirY#,X#-8,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#,DirY#,X#,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#+b#,DirY#,X#+8,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#+b#,DirY#,X#+16,Y#)
CreateProjectile(LoopID,Image,Type,Flag,DirX#+b#,DirY#,X#+24,Y#)
endif
return
HandleEnemy:
gosub EnemySpawn
gosub EnemyControl
return
EnemySpawn:
`Ashingda - Increase the Time counter
if TimeLine < 20
TimeLine = (timer()-StartTime)/2000
endif
`Ashingda - If the time is updated
if TimeLine <> OldTime
for lp = 0 to 2
AI = Map(TimeLine,lp)
if AI > 0
CreateEnemy(AI,MAX_ENEMY)
endif
next lp
endif
`Ashingda - Record the old time
OldTime = TimeLine
return
EnemyControl:
for lp = 0 to 25
if EnemyID(lp) > 0
`Ashingda - Move the Enemy
EnemyX#(lp) = EnemyX#(lp) + EnemyMoveX#(lp)
EnemyY#(lp) = EnemyY#(lp) + EnemyMoveY#(lp)
DX = WayPointX(EnemyAI(lp),EnemyTravel(lp)+1)
DY = WayPointY(EnemyAI(lp),EnemyTravel(lp)+1)
if EnemyTravel(lp) = 2
DX = WayPointX(EnemyAI(lp),0)
DY = WayPointY(EnemyAI(lp),0)
endif
`Ashingda - Distance Check
diffX = DX-EnemyX#(lp)
diffY = DY-EnemyY#(lp)
Distance = sqrt(diffX*diffX + diffY*diffY)
`Ashingda - Switch to Next Node
if Distance < 1
EnemyTravel(lp) = EnemyTravel(lp) + 1
if EnemyTravel(lp) < 2 or EnemyAI(lp) = 9
if EnemyTravel(lp) > 2 then EnemyTravel(lp) = 0
EnemyX#(lp) = WayPointX(EnemyAI(lp),EnemyTravel(lp))
EnemyY#(lp) = WayPointY(EnemyAI(lp),EnemyTravel(lp))
`Ashingda - Find the difference
DiffX# = WayPointX(EnemyAI(lp),EnemyTravel(lp)+1) - EnemyX#(lp)
DiffY# = WayPointY(EnemyAI(lp),EnemyTravel(lp)+1) - EnemyY#(lp)
if EnemyTravel(lp) = 2
DiffX# = WayPointX(EnemyAI(lp),0) - EnemyX#(lp)
DiffY# = WayPointY(EnemyAI(lp),0) - EnemyY#(lp)
endif
`Ashingda - Find the Positive value
CheckDiffX# = abs(DiffX#)
CheckDiffY# = abs(DiffY#)
`Ashingda - Setting up the Move variable
if CheckDiffX# > CheckDiffY#
EnemyMoveX#(lp) = DiffX#/CheckDiffX#
EnemyMoveY#(lp) = DiffY#/CheckDiffX#
else
EnemyMoveX#(lp) = DiffX#/CheckDiffY#
EnemyMoveY#(lp) = DiffY#/CheckDiffY#
endif
else
EnemyID(lp) = 0
endif
endif
`Ashingda - Enemy Shooting
if EnemyDelay(lp) = 0
`Ashingda - Creating the Shot
if EnemyAI(lp) = 9
EnemyDelay(lp) = 32+rnd(16)
else
EnemyDelay(lp) = 32+rnd((130/PlayerWep))
endif
LoopID = MAX_PROJECTILE_ID
Image = IMG_SHOT_ENEMY
Type = WEP_SHOT_ENEMY
Flag = 1
if EnemyAI(lp) = 9
Gun1 = -1
Gun2 = 1
ShotSpeed# = 1
else
Gun1 = 0
Gun2 = 0
ShotSpeed# = 1.5
endif
for lpGun = Gun1 to Gun2
`Ashingda - Targeted Shots
DiffX# = (PlayerX#) - EnemyX#(lp) + lpGun*32
DiffY# = PlayerY# - EnemyY#(lp)
`Ashingda - Randomized Straight shot
if lpGun <> 0
if lpGun = -1 then DiffX# = (EnemyX#(lp)-rnd(200)) - EnemyX#(lp)
if lpGun = 1 then DiffX# = (EnemyX#(lp)+rnd(200)) - EnemyX#(lp)
DiffY# = 480.0 - EnemyY#(lp)
endif
`Ashingda - Find the Positive value
CheckDiffX# = abs(DiffX#)
CheckDiffY# = abs(DiffY#)
`Ashingda - Setting up the Move variable
if CheckDiffX# > CheckDiffY#
DirX# = DiffX#/CheckDiffX#
DirY# = DiffY#/CheckDiffX#
else
DirX# = DiffX#/CheckDiffY#
DirY# = DiffY#/CheckDiffY#
endif
DirX# = DirX#*ShotSpeed#
DirY# = DirY#*ShotSpeed#
X# = EnemyX#(lp) + lpGun*32
Y# = EnemyY#(lp)
CreateProjectile(LoopID,Image,Type,Flag,DirX#,DirY#,X#,Y#)
next lpGun
endif
`Ashingda - Decrease Delay
if EnemyDelay(lp) > 0 then EnemyDelay(lp) = EnemyDelay(lp) - 1
endif
next lp
return
HandleProjectile:
for lp = 0 to MAX_PROJECTILE_ID
if ProjectileID(lp) > 0
`Ashingda - Moving the projectile
ProjectileX#(lp) = ProjectileX#(lp) + ProjectileDirectionX#(lp)
ProjectileY#(lp) = ProjectileY#(lp) + ProjectileDirectionY#(lp)
`Ashingda - Checks if Weapon is SHOTs
if ProjectileType(lp) = WEP_SHOT_PLAYER or ProjectileType(lp) = WEP_SHOT_ENEMY
`Ashingda - Collision Check SHOT
if ProjectileFlag(lp) = 0
`Ashingda - Player Projectile Hitting Enemy
for lpE = 0 to MAX_ENEMY
`Ashingda - If Enemy is Active
if EnemyID(lpE) > 0
`Ashingda - Seting up Values for Collision Check
cx = ProjectileX#(lp)
cy = ProjectileY#(lp)
if EnemyAI(lpE) < 0 then Size = 32 else Size = 64
x1 = EnemyX#(lpE)-Size/2
y1 = EnemyY#(lpE)-Size/2
x2 = x1+Size
y2 = y1+Size
`Ashingda - Checking Collision Area
if CollisionCheckArea(cx,cy,x1,y1,x2,y2)
X = cx - x1
Y = cy - y1
if EnemyAI(lpE) < 0 then IMG = IMG_ENEMY else IMG = IMG_BOSS
`Ashingda - Checking Pixels for Collision
if MemBlockCollision(MEM_COLLISION,IMG,X,Y)
x = ProjectileX#(lp)
y = ProjectileY#(lp)
ExplosionSize = 18
CreateExplosion(x,y,ExplosionSize,1)
EnemyID(lpE) = EnemyID(lpE) - 9
Score = Score + 1
if EnemyID(lpE) < 1
RndShot = rnd(50)
if RndShot = 50
Type = POW_BOMB
Image = IMG_BOMB_POWERUP
CreatePowerUp(MAX_POWERUP,Type,Image,X,Y)
endif
if RndShot < 30/PlayerWep
Type = POW_SHOT
Image = IMG_SHOT_POWERUP
CreatePowerUp(MAX_POWERUP,Type,Image,X,Y)
endif
Score = Score + 10
if EnemyAI(lpE) = 9
Score = Score + 2000
State$ = "GameWin"
show mouse
endif
endif
ProjectileID(lp) = 0
lpE = MAX_ENEMY
endif
endif
endif
next lpE
else
`Ashingda - Enemy Projectile Hiting Player
cx = ProjectileX#(lp)
cy = ProjectileY#(lp)
x1 = PlayerX#-16
y1 = PlayerY#-16
x2 = x1+32
y2 = y1+32
`Ashingda - Checking Collision Area
if CollisionCheckArea(cx,cy,x1,y1,x2,y2)
X = cx - x1
Y = cy - y1
IMG = IMG_PLAYER
`Ashingda - Checking Pixels for Collision
if MemBlockCollision(MEM_COLLISION,IMG,X,Y)
x = ProjectileX#(lp)
y = ProjectileY#(lp)
ExplosionSize = 18
CreateExplosion(x,y,ExplosionSize,1)
ProjectileID(lp) = 0
Health = Health - 1
endif
endif
endif
endif
`Ashingda - Checks if Weapon is BOMBs
if ProjectileType(lp) = WEP_BOMB_PLAYER
if ProjectileID(lp) > 1
ProjectileID(lp) = ProjectileID(lp) - 1
else
`Ashingda - Explodes BOOM!
ProjectileID(lp) = 0
ExplosionSize = 64*2
x = ProjectileX#(lp)
y = ProjectileY#(lp)
CreateExplosion(x,y,ExplosionSize,10)
`Ashingda - CollisionCheck for Bomb Killing Enemy
for lpE = 0 to MAX_ENEMY
if EnemyID(lpE) > 0
DiffX = x - EnemyX#(lpE)
DiffY = y - EnemyY#(lpE)
distance = sqrt(DiffX*DiffX+DiffY*DiffY)
if distance < ExplosionSize
EnemyID(lpE) = EnemyID(lpE) - 200
Score = Score + 1
if EnemyID(lpE) < 1
RndShot = rnd(50)
if RndShot = 50
Type = POW_BOMB
Image = IMG_BOMB_POWERUP
CreatePowerUp(MAX_POWERUP,Type,Image,X,Y)
endif
if RndShot < 30/PlayerWep
Type = POW_SHOT
Image = IMG_SHOT_POWERUP
CreatePowerUp(MAX_POWERUP,Type,Image,X,Y)
endif
Score = Score + 10
if EnemyAI(lpE) = 9
Score = Score + 2000
State$ = "GameWin"
show mouse
endif
endif
x2 = EnemyX#(lpE)
y2 = EnemyY#(lpE)
ExplosionSize2 = 18
CreateExplosion(x2,y2,ExplosionSize2,1)
endif
endif
next lpE
`Ashingda - CollisionCheck Removing Enemy Shots
for lpP = 0 to MAX_PROJECTILE_ID
if ProjectileID(lpP) > 0
if ProjectileFlag(lpP) > 0
DiffX = x - ProjectileX#(lpP)
DiffY = y - ProjectileY#(lpP)
distance = sqrt(DiffX*DiffX+DiffY*DiffY)
if distance < ExplosionSize
ProjectileID(lpP) = 0
x2 = ProjectileX#(lpP)
y2 = ProjectileY#(lpP)
ExplosionSize2 = 9
CreateExplosion(x2,y2,ExplosionSize2,1)
endif
endif
endif
next lpE
endif
endif
`Ashingda - Free Projectile if it's off the screen
if ProjectileY#(lp) < -32 or ProjectileY#(lp) > 500
ProjectileID(lp) = 0
endif
endif
next lp
return
HandlePowerUp:
for lp = 0 to MAX_POWERUP
if PowerUpID(lp) > 0
`Ashingda - Move the PowerUps
if PowerUpDrY#(lp) < 0 then PowerUpSlow = 2 else PowerUpSlow = 1
PowerUpX#(lp) = PowerUpX#(lp) + PowerUpDrX#(lp)
PowerUpY#(lp) = PowerUpY#(lp) + PowerUpDrY#(lp)/PowerUpSlow
if PowerUpX#(lp) < 96 or PowerUpX#(lp) > 416
PowerUpDrX#(lp) = PowerUpDrX#(lp) * -1
PowerUpX#(lp) = PowerUpX#(lp) + PowerUpDrX#(lp)
endif
if PowerUpY#(lp) < 16 or PowerUpY#(lp) > 480-16
PowerUpDrY#(lp) = PowerUpDrY#(lp) * -1
if PowerUpDrY#(lp) < 0 then PowerUpSlow = 2 else PowerUpSlow = 1
PowerUpY#(lp) = PowerUpY#(lp) + PowerUpDrY#(lp)/PowerUpSlow
endif
`Ashingda - Checks for collision with the Player
DiffX = PowerUpX#(lp) - PlayerX#
DiffY = PowerUpY#(lp) - PlayerY#
distance = sqrt(DiffX*DiffX+DiffY*DiffY)
if distance < 16
PowerUpID(lp) = 0
Score = Score + 10
if PowerUpType(lp) = POW_SHOT
if PlayerWep < 7 then PlayerWep = PlayerWep + 1
endif
if PowerUpType(lp) = POW_BOMB
Bombs = Bombs + 1
endif
endif
endif
next lp
return
HandleDisplay:
gosub DisplayWaterTile
gosub DisplayProjectile
gosub DisplayPowerUp
gosub DisplayEnemy
gosub DisplayPlayer
gosub DisplayExplosion
gosub DisplayGUI
return
DisplayWaterTile:
`Ashingda - Draws the Water Tiles
WaterTileX = 80
for lpy = 0 to 15
for lpx = 0 to 11
paste image IMG_TILE_WATER,lpx*32+WaterTileX,lpy*32+ScrollWaterY
next lpx
next lpy
return
DisplayProjectile:
`Ashingda - Draws the Projectile Images
for lp = 0 to MAX_PROJECTILE_ID
if ProjectileID(lp) > 0
IMG = ProjectileImage(lp)
X = ProjectileX#(lp)
Y = ProjectileY#(lp)
if IMG = IMG_SHOT_PLAYER then paste image IMG,X-4,Y,1
if IMG = IMG_SHOT_ENEMY then paste image IMG,X-4,Y-10,1
if IMG = IMG_BOMB_PLAYER then paste image IMG,X-8,Y,1
endif
next lp
return
DisplayPowerUp:
for lp = 0 to MAX_POWERUP
if PowerUpID(lp) > 0
x = PowerUpX#(lp)
y = PowerUpY#(lp)
img = PowerUpImage(lp)
paste image Img,x-8,y-8,1
endif
next lp
return
DisplayEnemy:
for lp = 0 to MAX_ENEMY
if EnemyID(lp) > 0
x# = EnemyX#(lp)
y# = EnemyY#(lp)
if EnemyAI(lp) < 9
paste image IMG_ENEMY,x#-16,y#-16,1
else
paste image IMG_BOSS,x#-32,y#-32,1
endif
endif
next lp
return
DisplayPlayer:
`Ashingda - Draws the Player Image
paste image IMG_PLAYER,PlayerX#-16,PlayerY#-16,1
return
DisplayExplosion:
for lp = 0 to 100
if ExplosionID(lp) > 0
ExplosionID(lp) = ExplosionID(lp) + ExplosionSpeed(lp)
if ExplosionID(lp) => ExplosionS(lp) then ExplosionID(lp) = 0
x = ExplosionX(lp)
y = ExplosionY(lp)
ink rgb(255,200,150),0
circle x,y,ExplosionID(lp)
circle x,y,ExplosionID(lp)/1.5
endif
next lp
return
DisplayGUI:
`Ashingda - Black side borders
ink 0,0
box 0,0,WaterTileX-1,479
box WaterTileX+11*32,0,639,479
`Ashingda - Display the Score
ink rgb(255,255,255),0
text 450,50,"Score: "+str$(Score)
`Ashingda - Display the Health
text 450,110,"Health: "+str$(Health)
ink rgb(255,255,255),0
box 449,129,551,141
ink rgb(255,0,0),0
box 450,130,450+Health*10,140
`Ashingda - Display the amount of Bombs
ink rgb(255,255,255),0
text 450,180,"Weapon: "+str$(PlayerWep)
text 450,200,"Bombs: "+str$(Bombs)
x = 500
y = 280
text x,y-32,"CONTROLS"
text x,y,"Arrow Keys:"
text x,y+16*1," Move"
text x,y+16*3,"Enter Key:"
text x,y+16*4," Menu"
text x,y+16*6,"1: Shoot"
text x,y+16*7,"2: Bomb"
return
GameMenu:
gosub HandleKeys
gosub HandleBackGround
gosub DisplayWaterTile
gosub DisplayGUI
`Ashingda - Box
ink rgb(255,255,255),0
box 165,80,330,260
ink 0,0
box 175,90,320,250
`Ashingda - Text
ink rgb(255,255,255),0
if menu("Resume Game",185+20,170-45)
State$ = "Game"
hide mouse
click(0) = 1
endif
if menu("Return to Main Menu",185,200-45)
State$ = ""
click(0) = 1
endif
if menu("Exit Game",185+30,230-45)
end
endif
return
GameWin:
show mouse
gosub HandleKeys
gosub HandleBackGround
gosub DisplayWaterTile
gosub DisplayGUI
`Ashingda - Box
ink rgb(255,255,255),0
box 165,80,330,260
ink 0,0
box 175,90,320,250
`Ashingda - Text
ink rgb(255,255,255),0
center text 245,100,"YOU WIN!"
center text 245,120,"Score:"+str$(Score)
if menu("Return to Main Menu",185,200)
State$ = ""
click(0) = 1
endif
return
GameOver:
show mouse
gosub HandleKeys
gosub HandleBackGround
gosub DisplayWaterTile
gosub DisplayGUI
`Ashingda - Box
ink rgb(255,255,255),0
box 165,80,330,260
ink 0,0
box 175,90,320,250
`Ashingda - Text
ink rgb(255,255,255),0
center text 245,100,"GAME OVER!"
center text 245,120,"Score:"+str$(Score)
if menu("Return to Main Menu",185,200)
State$ = ""
click(0) = 1
endif
return
REM *************************Functions******************************
Function Menu(s$,x1,y1)
x2 = x1 + text width(s$)
y2 = y1 + text height(s$)
ink rgb(255,255,0),0
box x1,y1,x2+6,y2+6
ink rgb(0,0,255),0
box x1+2,y1+2,x2+4,y2+4
ink rgb(255,255,255),0
text x1+4,y1+4,s$
if mx(0)>x1 and mx(0)<x2+6 and my(0)>y1 and my(0)<y2+6 and mc(0) = 1
ReturnValue = 1
else
ReturnValue = 0
endif
EndFunction ReturnValue
Function CreateImage(IMG,MEM_BUFFER)
`Ashingda - Setting up the PaletteColor of this Image
Counter = 0
for lp = 1 to len(Data$(0))
StringInput$ = mid$(Data$(0),lp)
if StringInput$ = ","
PaletteColor(Counter) = val(StringSave$)
StringSave$ = ""
Counter = Counter + 1
else
StringSave$ = StringSave$ + StringInput$
endif
next lp
`Ashingda - Setting up the Image
CounterX = 0
CounterY = 0
for lpy = 1 to 4
for lpx = 1 to len(Data$(lpy))
`Ashingda - Input from the Data$()
ValInput = val(mid$(Data$(lpy),lpx))
`Ashingda - Positon of Memblock
pos = 12+(CounterX+CounterY*16)*4
`Ashingda - Writing to Memblock
write memblock dword MEM_BUFFER,pos,PaletteColor(ValInput)
`Ashingda - Increasing the X,Y counters
CounterX = CounterX + 1
if CounterX > 15
CounterY = CounterY + 1
CounterX = 0
endif
next lpx
next lpy
`Ashingda - Creating the Image from the Memblock
make image from memblock IMG,MEM_BUFFER
EndFunction
Function SizeImage(Img,Size)
`Ashingda - Creating Memblock(1) from the Image
make memblock from image 1,Img
wd1 = memblock dword(1,0)
ht1 = memblock dword(1,4)
dp = memblock dword(1,8)
`Ashingda - Setting up the variables
Size# = 100.0/Size
wd2 = wd1/Size#
ht2 = ht1/Size#
`Ashingda - ReCreate the Memblock(2)
if memblock exist(2) then delete memblock 2
make memblock 2,(wd2+(ht2*wd2))*4
write memblock dword 2,0,wd2
write memblock dword 2,4,ht2
write memblock dword 2,8,dp
`Ashingda - Starting the data Transfer
for y2 = 0 to ht2-1
for x2 = 0 to wd2-1
x1 = x2*Size#
y1 = y2*Size#
`Ashingda - Reading from Memblock(1)
pos = 12 + (x1+(y1*wd1))*4
b = memblock byte(1,pos+0)
g = memblock byte(1,pos+1)
r = memblock byte(1,pos+2)
a = memblock byte(1,pos+3)
`Ashingda - Writing to Memblock(2)
pos = 12 + (x2+(y2*wd2))*4
write memblock byte 2,pos+0,b
write memblock byte 2,pos+1,g
write memblock byte 2,pos+2,r
write memblock byte 2,pos+3,a
next x2
next y2
`Ashingda - Creating the Image from Memblock(2)
make image from memblock Img,2
EndFunction
Function CreateProjectile(LoopID,Image,Type,Flag,DirX#,DirY#,X#,Y#)
for lp = 0 to LoopID
`Ashingda - Checks if the ID is (zero) free to use
if ProjectileID(lp) < 1
`Ashingda - Setting the Projectile data
ProjectileID(lp) = 30
ProjectileImage(lp) = Image
ProjectileType(lp) = Type
ProjectileFlag(lp) = Flag
ProjectileDirectionX#(lp) = DirX#
ProjectileDirectionY#(lp) = DirY#
ProjectileX#(lp) = X#
ProjectileY#(lp) = Y#
`Ashingda - Exiting the loop
lp = LoopID
endif
next lp
EndFunction
Function LoadAI()
CountAI = 1
Count = 0
NodeCount = 0
StringSave$ = ""
for lpy = 0 to 4
for lpx = 1 to len(Data$(lpy))
StringInput$ = mid$(Data$(lpy),lpx)
if StringInput$ = ","
if Count = 0
WayPointX(CountAI,NodeCount) = val(StringSave$)
Count = 1
else
WayPointY(CountAI,NodeCount) = val(StringSave$)
Count = 0
if NodeCount < 2
NodeCount = NodeCount + 1
else
NodeCount = 0
CountAI = CountAI + 1
endif
endif
StringSave$ = ""
else
StringSave$ = StringSave$ + StringInput$
endif
next lpx
next lpy
EndFunction
Function LoadMap()
Count = 1
for lpy = 0 to 20
map(lpy,0) = val(mid$(Data$(0),Count+0))
map(lpy,1) = val(mid$(Data$(0),Count+1))
map(lpy,2) = val(mid$(Data$(0),Count+2))
Count = Count + 3
next lpy
EndFunction
Function CreateEnemy(AI,MAX_ENEMY)
`Ashingda - Search for a free ID
for lp = 0 to MAX_ENEMY
if EnemyID(lp) < 1
`Ashingda - Activate Enemy
EnemyID(lp) = 50
EnemyAI(lp) = AI
if EnemyAI(lp) = 9 then EnemyID(lp) = 10000
EnemyDelay(lp) = 50+rnd(30)
EnemyTravel(lp) = 0
EnemyX#(lp) = WayPointX(EnemyAI(lp),0)
EnemyY#(lp) = WayPointY(EnemyAI(lp),0)
`Ashingda - Find the difference
DiffX# = WayPointX(EnemyAI(lp),EnemyTravel(lp)+1) - EnemyX#(lp)
DiffY# = WayPointY(EnemyAI(lp),EnemyTravel(lp)+1) - EnemyY#(lp)
`Ashingda - Find the Positive value
CheckDiffX# = abs(DiffX#)
CheckDiffY# = abs(DiffY#)
`Ashingda - Setting up the Move variable
if CheckDiffX# > CheckDiffY#
EnemyMoveX#(lp) = DiffX#/CheckDiffX#
EnemyMoveY#(lp) = DiffY#/CheckDiffX#
else
EnemyMoveX#(lp) = DiffX#/CheckDiffY#
EnemyMoveY#(lp) = DiffY#/CheckDiffY#
endif
`Ashingda - Exit the Loop
lp = MAX_ENEMY
endif
next lp
EndFunction
Function CreateExplosion(X,Y,S,Speed)
For lp = 0 to 100
if ExplosionID(lp) = 0
ExplosionID(lp) = 1
ExplosionX(lp) = X
ExplosionY(lp) = Y
ExplosionS(lp) = S
ExplosionSpeed(lp) = Speed
lp = 100
endif
next lp
EndFunction
Function CollisionCheckArea(cx,cy,x1,y1,x2,y2)
if cx => x1 and cx < x2 and cy => y1 and cy < y2
ReturnValue = 1
else
ReturnValue = 0
endif
EndFunction ReturnValue
Function MemBlockCollision(MEM_COLLISION,IMG,x,y)
`Ashingda - Creating the Memblock
make memblock from image MEM_COLLISION,IMG
wd = Memblock dword(MEM_COLLISION,0)
ht = Memblock dword(MEM_COLLISION,4)
`Ashingda - Setting the Position
pos = 12+(x+y*wd)*4
`Ashingda - Black out the Alpha channel
write memblock byte MEM_COLLISION,pos+3,0
`Ashingda - Checking the pixel color, if Black then no Collision
if memblock Dword(MEM_COLLISION,pos) > 0
ReturnValue = 1
else
ReturnValue = 0
endif
EndFunction ReturnValue
Function CreatePowerUp(MAX_POWERUP,Type,Image,X,Y)
for lp = 0 to MAX_POWERUP
if PowerUpID(lp) < 1
`Ashingda - Activating the PowerUp
PowerUpID(lp) = 150
PowerUPType(lp) = Type
PowerUPImage(lp) = Image
PowerUpX#(lp) = X
PowerUpY#(lp) = Y
PointX = 80+rnd(11*32)
PointY = 240+rnd(240)
`Ashingda - Find the difference
DiffX# = PointX - X
DiffY# = PointY - Y
`Ashingda - Find the Positive value
CheckDiffX# = abs(DiffX#)
CheckDiffY# = abs(DiffY#)
`Ashingda - Setting up the Move variable
if CheckDiffX# > CheckDiffY#
PowerUpDrX#(lp) = DiffX#/CheckDiffX#
PowerUpDrY#(lp) = DiffY#/CheckDiffX#
else
PowerUpDrX#(lp) = DiffX#/CheckDiffY#
PowerUpDrY#(lp) = DiffY#/CheckDiffY#
endif
lp = MAX_POWERUP
endif
next lp
EndFunction
Razerx
set display mode 640,480,32
sync on : sync rate 100
hide mouse
maxT=50
dim time(maxT)
dim x(maxT)
dim y(maxT)
dim Etime(maxT)
dim dir(maxT)
gosub cross:cls
gosub circle
Restart:
gosub menu:cls
restore round1
maxT=25
score=0
round=0
shots#=0
` ~MAIN LOOP~
DO
if shots#>0
text 270,180, "4X TARGETS "+str$(hit#)+"/"+str$(maxT)
text 270,200, "1X HIT%:"+str$((hit#/shots#)*100.0)
text 270,220, "2X BULLSEYE%:"+str$((bull#/shots#)*100.0)
bonus=((hit#/shots#)*100.0)+(2*((bull#/shots#)*100.0))+(4*hit#)
text 270,240, "BONUS:"+str$(bonus)
score=score+bonus
text 270,260, "SCORE:"+str$(score)
sleep 500
suspend for mouse:cls
endif
round=round+1
if round=6 then goto win
if round=5 then maxT=50
bull#=0:hit#=0:miss#=0:shots#=0
a=0
ink rgb(40,40,40),0
box 0,450,639,479
ink rgb(255,255,255),rgb(20,20,20)
text 50,457, "SCORE:"+str$(score)
if shots#>0
text 225,457, "HIT%:"+str$((hit#/shots#)*100.0)
text 435,457, "BULLSEYE%:"+str$((bull#/shots#)*100.0)
endif
text 270,220, "ROUND "+str$(round)
sleep 3000:cls
oldtime=timer()
for n=1 to maxT
read time(n)
read Etime(n)
read x(n)
read y(n)
read dir(n)
x(n)=x(n)*64-64
y(n)=y(n)*64-64
next n
WHILE forever=0
oldmiss=miss#:oldhit=hit#:oldbull=bull#
ink rgb(40,40,40),0
box 0,450,639,479
ink rgb(255,255,255),rgb(20,20,20)
text 50,457, "SCORE:"+str$(score)
if shots#>0
text 225,457, "HIT%:"+str$((hit#/shots#)*100.0)
text 435,457, "BULLSEYE%:"+str$((bull#/shots#)*100.0)
endif
if a>0
if color=1 then ink rgb(0,0,225),rgb(20,20,20)
if color=2 then ink rgb(0,175,0),rgb(20,20,20)
if color=3 then ink rgb(225,225,0),rgb(20,20,20)
if color=4 then ink rgb(225,0,0),rgb(20,20,20)
text oldmx-21,oldmy-10, text$
ink rgb(255,255,255),rgb(20,20,20)
a=a-1
endif
mx=mousex():my=mousey()
time=(timer()-oldtime)/1000
for n=1 to maxT
if time>=time(n) and time<=Etime(n)
if dir(n)>0
if dir(n)=1 then y(n)=y(n)-1
if dir(n)=2 then x(n)=x(n)+1
if dir(n)=3 then y(n)=y(n)+1
if dir(n)=4 then x(n)=x(n)-1
endif
paste image n,x(n),y(n),1
endif
next n
if mouseclick()=0 then press=0
if mouseclick()=1 and press=0
press=1
for n=1 to maxT
if time>=time(n) and time<=Etime(n)
num=circlemouseover(x(n)+25,y(n)+25,24)
if num=1 then score=score+10:gosub check:hit#=hit#+1:color=1
if num=2 then score=score+20:gosub check:hit#=hit#+1:color=2
if num=3 then score=score+30:gosub check:hit#=hit#+1:color=3
if num=4 then score=score+50:gosub check:hit#=hit#+1:color=4:bull#=bull#+1
endif
next n
if hit#=oldhit
color=0
miss#=miss#+1
endif
endif
shots#=miss#+hit#
if oldmiss<miss# then a=27:text$="Miss":oldmx=mx:oldmy=my
if oldhit<hit# then a=27:text$="Hit":oldmx=mx:oldmy=my
if oldbull<bull# then a=27:text$="Bullseye":oldmx=mx:oldmy=my
paste image 51,mx-8,my-8,1
if round=1 and time=34 then cls:exit
if round=2 and time=22 then cls:exit
if round=3 and time=24 then cls:exit
if round=4 and time=25 then cls:exit
if round=5 and time=33 then cls:exit
sync:cls
ENDWHILE
LOOP
END
` ~SUB FILES~
win:
cls
oldfont$=text font$()
oldsize=text size()
set text size 100
set text font "verdana"
text 50,190, "SCORE:"+str$(score)
sleep 500
repeat
text 50,190, "SCORE:"+str$(score)
sync
cls
until mouseclick()=1
set text size oldsize
set text font oldfont$
sync
goto restart
cross:
ink rgb(200,200,200),0
line 8,0,8,16
line 0,8,16,8
ink rgb(0,0,0),0
dot 8,8
get image maxT+1,0,0,16,16
return
menu:
ny=223
nx=-100
do
cls
paste image 1,nx,ny,1
ink rgb(255,255,225),rgb(20,20,20)
text 190,190, "Get points by shooting the targets"
ink rgb(0,0,225),rgb(20,20,20)
text 190,210, "BLUE:10"
ink rgb(0,175,0),rgb(20,20,20)
text 190,230, "GREEN:20"
ink rgb(225,225,0),rgb(20,20,20)
text 190,250, "YELLOW:30"
ink rgb(225,0,0),rgb(20,20,20)
text 190,270, "RED:50"
if nx<125 then nx=nx+1
ink rgb(255,255,225),rgb(20,20,20)
if nx=125 then text 190,290, "Click to continue"
if nx=125 and mouseclick()=1 then exit
sync
loop
return
check:
x(n)=1000:y(n)=1000
return
` ~That1Smart Guy's circlemaker~
circle:
ink rgb(0,0,225),0
for x=0 to 49
for y=0 to 49
if distance#(x,y,25,25)<=24
dot x,y
endif
next y
next x
```````
ink rgb(0,175,0),0
for x=0 to 49
for y=0 to 49
if distance#(x,y,25,25)<=18
dot x,y
endif
next y
next x
```````````
ink rgb(225,225,0),0
for x=0 to 49
for y=0 to 49
if distance#(x,y,25,25)<=12
dot x,y
endif
next y
next x
`````````
ink rgb(225,0,0),0
for x=0 to 49
for y=0 to 49
if distance#(x,y,25,25)<=6
dot x,y
endif
next y
next x
for x=1 to maxT
get image x,0,0,60,60
next x
return
`````````````````````~That1Smart Guy's insidecirclefinder~
function circlemouseover(x,y,rad)
mx=mousex() : my=mousey()
dist#=distance#(mx,my,x,y)
if dist#<=rad-18 then exitfunction 4
if dist#<=rad-12 then exitfunction 3
if dist#<=rad-6 then exitfunction 2
if dist#<=rad then exitfunction 1
endfunction 0
function distance#(x1,y1,x2,y2)
dist#=abs(sqrt(((x2-x1)*(x2-x1))+((y2-y1)*(y2-y1))))
endfunction dist#
`````````````````````
` ~DATA~
` time-start,time-end,X,Y,direction
Round1:
data 1,5,4,4,0, 2,5,5,4,0, 3,5,6,4,0, 4,5,7,4,0, 6,11,7,3,0
data 6,11,4,3,0, 6,11,4,5,0, 6,11,7,5,0, 12,15,5,3,0, 12,15,7,3,0
data 13,15,5,5,0, 13,15,7,5,0, 16,23,1,4,0, 17,23,10,4,0, 18,23,5,1,0
data 19,23,6,7,0, 20,23,6,1,0, 21,23,5,7,0, 22,24,5,4,0, 23,24,6,4,0
data 25,28,1,4,2, 28,31,5,1,3, 28,31,6,1,3, 31,32,5,7,1, 31,32,6,7,1
Round2:
data 1,6,1,1,0, 2,6,10,1,0, 3,6,1,7,0, 4,6,10,7,0, 6,8,4,3,0
data 6,8,5,3,0, 6,8,6,3,0, 7,9,6,4,0, 7,9,4,4,0, 7,9,5,4,0
data 11,16,3,3,0, 12,16,4,3,0, 13,16,5,3,0, 14,16,6,3,0, 15,16,7,3,0
data 11,16,7,4,0, 12,16,6,4,0, 13,16,5,4,0, 14,16,4,4,0, 15,16,3,4,0
data 17,20,1,1,2, 17,20,1,7,2, 17,20,1,4,2, 17,20,10,3,4, 17,20,10,5,4
Round3:
data 1,5,5,7,1, 2,5,1,1,0, 2,5,4,1,0, 2,5,6,1,0, 2,5,10,1,0
data 5,7,5,4,0, 6,8,5,3,1, 8,10,5,5,3, 9,11,4,3,4, 7,9,6,3,2
data 10,13,5,0,3, 10,13,6,0,3, 10,13,5,8,1, 10,13,6,8,1, 15,21,1,4,0
data 15,21,10,4,0, 16,21,1,1,0, 16,21,10,7,0, 17,21,5,1,0, 17,21,5,7,0
data 18,22,1,7,0, 18,22,10,1,0, 19,22,1,4,0, 19,22,10,4,0, 20,23,5,4,0
Round4:
data 1,4,5,1,4, 1,4,6,1,2, 1,4,5,7,4, 1,4,6,7,2, 5,8,1,1,0
data 5,8,10,1,0, 6,8,1,7,0, 6,8,10,7,0, 7,10,5,4,0, 7,10,6,4,0
data 11,14,5,4,4, 11,14,6,4,2, 12,14,5,4,1, 12,14,6,4,3, 14,17,1,1,0
data 14,17,10,7,0, 15,17,10,1,0, 15,17,1,7,0, 16,18,1,4,2, 16,18,10,4,4
data 18,24,5,1,4, 18,24,6,1,2, 18,24,5,7,4, 18,24,6,7,2, 0,0,0,0,0
Round5:
data 1,5,4,4,1, 1,5,5,4,3, 1,5,6,4,1, 1,5,7,4,3, 3,7,4,4,3
data 3,7,5,4,1, 3,7,6,4,3, 3,7,7,4,1, 5,9,4,4,4, 5,9,5,4,4
data 5,9,6,4,2, 5,9,7,4,2, 7,11,4,3,3, 7,11,4,5,2, 7,11,6,3,4
data 7,11,6,5,1, 10,14,5,3,2, 10,14,5,5,1, 10,14,7,3,3, 10,14,7,5,4
data 13,16,4,3,0, 13,16,5,3,0, 13,16,6,3,0, 13,16,7,3,0, 14,16,4,5,0
data 14,16,5,5,0, 14,16,6,5,0, 14,16,7,5,0, 17,21,4,4,4, 17,21,5,4,3
data 17,21,6,4,1, 17,21,7,4,2, 20,25,1,1,2, 20,25,1,7,1, 20,25,10,1,3
data 20,25,10,7,4, 21,27,2,2,3, 21,27,2,6,2, 21,27,9,2,4, 21,27,9,6,1
data 26,32,1,0,3, 26,32,2,0,3, 26,32,3,0,3, 26,32,4,0,3, 26,32,5,0,3
data 26,32,6,0,3, 26,32,7,0,3, 26,32,8,0,3, 26,32,9,0,3, 26,32,10,0,3
NanoGamez guy
cls
sync on
hide mouse
level=1
radius#=(15-level)^2/4.9+20
if radius#<30 then radius#=30
speed#=level^0.7
mode=1
score=0
hits=0
misses=0
targetx=rnd(500)+70
targety=rnd(340)+70 : rem |_Move 2____|_Move 3____|_Move 4____|
tarmovvar1=0 : rem Target Move Variable 1 | start x | start y | centre x |
tarmovvar2=0 : rem Target Move Variable 2 | end x | end y | centre y |
tarmovvar3=0 : rem Target Move Variable 2 | direction | direction | angle |
tarmovvar4#=0 : rem Target Move Variable 4 | - | - | radius |
tarcmovstep#=0 : rem Target Circular Move Step
ink rgb(rnd(100)+150,rnd(100)+150,rnd(100)+150),0
do
cls
mx=mousex()
my=mousey()
position mouse mx+rnd(6)-3,my+rnd(6)-3
if mx<16 then mx=16
if my<16 then my=16
if mx>624 then mx=624
if my>464 then my=464
if mouseclick()=1
distance#=sqrt((targetx-mx)^2+(targety-my)^2)
if distance#<=radius#
set text size 60
if distance#<=radius#*0.8
if distance#<=radius#*0.6
if distance#<=radius#*0.4
if distance#<=radius#*0.2
center text 320,100,"BULLSEYE! 50 Points!"
score=score+50
bullseyes=bullseyes+1
else
center text 320,100,"40 Points!"
score=score+40
endif
else
center text 320,100,"30 Points"
score=score+30
endif
else
center text 320,100,"20 Points"
score=score+20
endif
else
center text 320,100,"10 Points"
score=score+10
endif
mode=mode+1
if mode=2
targetx=rnd(100)+70
targety=rnd(340)+70
tarmovvar1=targetx
tarmovvar2=rnd(100)+470
tarmovvar3=1
endif
if mode=3
targetx=rnd(500)+70
targety=rnd(100)+70
tarmovvar1=targety
tarmovvar2=rnd(100)+310
tarmovvar3=1
endif
if mode=4
repeat
tarmovvar1=rnd(500)+70
tarmovvar2=rnd(100)+70
tarmovvar4#=rnd(200)+50
until tarmovvar1-tarmovvar4#>70 and tarmovvar2-tarmovvar4#>70 and tarmovvar1+tarmovvar4#<570 and tarmovvar2+tarmovvar4#<410
targetx=tarmovvar1
targety=tarmovvar2-radius
tarmovvar3=270
tarcmovstep#=360/((tarmovvar4#*6.282)/speed#)
endif
if mode=5
level=level+1
radius#=(15-level)^2/4.9+20
if radius#<20 or level>=15 then radius#=20
print radius#
speed#=level^0.7
mode=1
center text 320,170,"Level Up"
ink rgb(rnd(100)+150,rnd(100)+150,rnd(100)+150),0
endif
hits=hits+1
else
set text size 60
center text 320,100,"Missed! -40 Points"
score=score-40
misses=misses+1
endif
sleep 500
endif
if mode=2
if tarmovvar3=1
targetx=targetx+speed#
else
targetx=targetx-speed#
endif
if targetx>tarmovvar2 then tarmovvar3=2
if targetx<tarmovvar1 then tarmovvar3=1
endif
if mode=3
if tarmovvar3=1
targety=targety+speed#
else
targety=targety-speed#
endif
if targety>tarmovvar2 then tarmovvar3=2
if targety<tarmovvar1 then tarmovvar3=1
endif
if mode=4
tarmovvar3=wrapvalue(tarmovvar3+tarcmovstep#)
targetx=tarmovvar1+cos(tarmovvar3)*tarmovvar4#
targety=tarmovvar2+sin(tarmovvar3)*tarmovvar4#
endif
circle targetx,targety,radius#
circle targetx,targety,radius#*0.8
circle targetx,targety,radius#*0.6
circle targetx,targety,radius#*0.4
circle targetx,targety,radius#*0.2
circle mx,my,10
line mx-15,my,mx-1,my
line mx+15,my,mx+1,my
line mx,my-15,mx,my-1
line mx,my+15,mx,my+1
shots#=(hits+misses)
hits#=hits
print "SCORE: ";score
print "LEVEL: ";level
print
if shots#>0
print "Bullseyes: ";bullseyes;", ";bullseyes/hits#*100.0;"%"
print "Accuracy: ";hits/shots#*100.0;"%"
endif
sync
loop
If I missed anyone or messed up on your entry, then please speak up.
I'll post the winners and runner ups after I make sure I got everyone.