//THE FREE GAME FOR ALL
// [][]
// ~
//
// by Chris Watkins
//http://www.facebook.com/profile.php?id=100000599288244
//copy paste AGK it and advance my friends :)
//Controls Are
`LeftMouseButton = ActMenu
`RightMouseButton = BuySellMenu
`f key = exit menu
`s key = Shop Menu
//dim the TARGETS and UNTARGETS increases per MOB per Level
//-------------------------
//CHRIS HOOK MENU TO GAME!
//MENUS NOT YET HOOKED UP to GAME.
//ITEMS BATTLE AND SYSTEM CONFIGURATION = NOT DONE/IMPLEMENTED //YET
//-------------------------
sync on
backdrop on
color backdrop rgb(0,0,0)
autocam off
//MechaRESTRICTorNO
//MechaACTION
//MechaARMOR
//MechaWEP
//Mecha
//Abilitys
//Spells
type NPC
sn as integer
in as integer
isGOD as boolean
isTrader as integer
endtype
type ITEM
sn as integer
in as integer
itemis as integer
name$ as string
power as integer
cost as integer
NPCsellable as integer
isAvalible as boolean
endtype
type WEPITEM
sn as integer
in as integer
itemis as integer
name$ as string
power as integer
cost as integer
NPCsellable as integer
isAvalible as boolean
endtype
type MOB
sn as integer
ID$ as string
lv as integer
xp as integer
xp2lv as integer
gold as integer
INCOMBAT as boolean
WEP as WEPITEM
ITEM1 as ITEM
ITEM2 as ITEM
ITEM3 as ITEM
mstr as integer
cstr as integer
mhp as integer
chp as integer
mmp as integer
cmp as integer
mdef as integer
cdef as integer
mspd as integer
cspd as integer
Target as integer
classe$ as string
PICWIDTH as integer
PICHEIGHT as integer
x as integer
y as integer
z as integer
endtype
global u as MOB
u.lv=1
u.xp2lv=1000
u.sn=1
u.gold=20000
//sprite code
u.ID$="Christopher Glenn Watkins"
u.z=1
//u.x=screen width()/2
//u.y=screen height()/2
u.x=0
u.y=0
randomize timer()
classx=rnd(3)
if classx=0
classe$="Warrior"
u.mstr=100
u.cstr=100
u.mspd=50
u.cspd=50
u.mdef=80
u.cdef=80
u.mhp=1000
u.chp=1000
u.mmp=0
u.cmp=0
endif
if classx=1
classe$="Cleric"
u.mstr=100
u.cstr=100
u.mspd=50
u.cspd=50
u.mdef=50
u.cdef=50
u.mhp=500
u.chp=500
u.mmp=500
u.cmp=500
endif
if classx=2
classe$="Mage"
u.mstr=100
u.cstr=100
u.mspd=50
u.cspd=50
u.mdef=50
u.cdef=50
u.mhp=2000
u.chp=200
u.mmp=1000
u.cmp=1000
endif
if classx=3
classe$="ApprenticeMage"
u.mstr=80
u.cstr=80
u.mspd=25
u.cspd=25
u.mdef=75
u.cdef=75
u.mhp=1000
u.chp=1000
u.mmp=2000
u.cmp=2000
endif
type MOBBLOCK
mstr as integer
cstr as integer
mhp as integer
chp as integer
mmp as integer
cmp as integer
mdef as integer
cdef as integer
mspd as integer
cspd as integer
x as integer
y as integer
z as integer
endtype
//Maximume Amount Of Mobs
global dim UNTARGETEDTHESEMOBS(9) as integer
global EF as MOB
global dim MOBDB(9) as MOB
//global dim MOBS(9) as MOBBLOCK
EF.chp=20000 : //add more here
EF.x=screen width()/2
EF.y=screen height()/2
global dim WEPITEMDB(1) as WEPITEM
global WI as WEPITEM
WI.name$="DeathSycer"
WI.power=250
WI.cost=20000
WI.sn=1
WI.in=1
WI.itemis=1
WI.IsAvalible=1
WI.NPCsellable=1
WEPITEMDB(0)=WI
global FirstReal as WEPITEM
FirstReal.name$="Bokken"
FirstReal.power=50
FirstReal.cost=250
FirstReal.sn=5
FirstReal.in=5
FirstReal.itemis=5
WI.IsAvalible=1
WI.NPCsellable=1
//latest item FirstReal
WEPITEMDB(1)=FirstReal
global dim ITEMDB(2) as ITEM
global WII as ITEM
WII.name$="HEAL250"
WII.power=250
WII.cost=0
WII.sn=2
WII.in=2
WII.itemis=2
ITEMDB(0)=WII
global WHY as ITEM
WHY.name$="ManaHeal"
WHY.power=1000
WHY.cost=0
WHY.sn=3
WHY.in=3
WHY.itemis=3
ITEMDB(1)=WHY
global WHY2 as ITEM
WHY2.name$="Pheonix"
WHY2.power=20000
WHY2.cost=0
WHY2.sn=4
WHY2.in=4
WHY2.itemis=4
ITEMDB(1)=WHY2
u.ITEM1=ITEMDB(0)
u.ITEM2=ITEMDB(1)
u.ITEM3=ITEMDB(2)
global dim uITEMINVENTORY(19) as ITEM
global dim uWEPITEMINVENTORY(19) as WEPITEM
uITEMINVENTORY(0)=ITEMDB(0)
uWEPITEMINVENTORY(0)=WEPITEMDB(0)
u.WEP=uWEPITEMINVENTORY(0)
MOBDB(0)=EF
mobsmove=1
Counter#=timer()
//menu globals
global ki as integer
global ko as integer
global k as integer
//0 = no shop / 1 = yes shop
InShop=0
ShowInven=0
global NPC1 as NPC
global dim NPCLIST(9) as NPC
do
cls
if u.lv>=1 and u.lv<=9 and dude=0
dude=1
endif
if keystate(31)=1 then InShop=1
if InShop=1
gosub SHOPmenu
endif
IF InShop=1
for i=0 to array count(WEPITEMDB(0))
ANW=k
if WEPITEMDB(i).NPCsellable=1 then ANW=i
if WEPITEMDB(i).NPCsellable=1 and i=ANW then exit
next i
InShop=0
ENDIF
CD#=timer()-Counter#
if u.chp>0
if rightkey()=1 and CD#>=499 then inc u.x, 20
if leftkey()=1 and CD#>=499 then dec u.x, 20
if upkey()=1 and CD#>=499 then dec u.y, 20
if downkey()=1 and CD#>=499 then inc u.y, 20
if CD#>=499 then Counter#=timer()
if u.x<0 then u.x=0
if u.x>screen width()-20 then u.x=screen width()-20
if u.y<0 then u.y=0
if u.y>screen height()-20 then u.y=screen height()-20
text u.x, u.y, "@"
else
cls
print "Your Died. In This Game."
sync
end
endif
if mobsmove=1
ai=1
if ai=1 then TYPE$="RANDOM MOVE with COOLDOWN TIMER"
if ai=0 then TYPE$="No Move"
endif
Ec#=timer()-Ecount#
if MOBDB(0).chp>0
if ai=1 and Ec#>=499
r=rnd(1+3)
if r=1 then inc MOBDB(0).x, 20
if r=2 then dec MOBDB(0).x, 20
if r=3 then inc MOBDB(0).y, 20
if r=4 then dec MOBDB(0).y, 20
Ecount#=timer()
endif
if MOBDB(0).x<0 then MOBDB(0).x=0
if MOBDB(0).x>screen width()-20 then MOBDB(0).x=screen width()-20
if MOBDB(0).y<0 then MOBDB(0).y=0
if MOBDB(0).y>screen height()-20 then MOBDB(0).y=screen height()-20
text MOBDB(0).x, MOBDB(0).y, "#"
endif
//Left Click
WANTMENU=1
if mouseclick()=1 then WANTMENU=0
if WANTMENU=0 then gosub ActMenu
//Right Click
WM=1
if mouseclick()=2 then WM=0
if WM=0 then gosub BuySellMenu
if keystate(23)=1 then ShowInven=1
if ShowInven=1
for i=0 to array count(uWEPITEMINVENTORY(0))
cls
if uWEPITEMINVENTORY(i).IsAvalible=1 then print str$(i) + " = " + uWEPITEMINVENTORY(i).name$ else abc=1
sync
next i
if abc=1 then wait key
abc=0
ShowInven=0
endif
MODFAME=GETHILO(10, 10) `0-20
MOD50=GETHILO(50, 50) : `0-200
MOD100=GETHILO(100, 100) `0-400
MOD510=GETHILO(5, 10) `0-5
//First Boss Attacks
MOD1=GETHILO(1, 4)+rnd(19) ` All hits in between First hit and Special
MOD2=GETHILO(7, 17)+rnd(4) ` First hit
MOD3=GETHILO(10, 25)*rnd(4) : `Special
if u.Target<>-1
w=GetDist(u.x, u.y, MOBDB(u.Target).x, MOBDB(u.Target).y)
//print str$(w)
//THESE if w<=2000 --- w>=4000 are text based values
//2d has built in collision
//3d has build in collision or 3d has built in collision
if w<=2000 then u.INCOMBAT=1
if u.INCOMBAT=1 then dec MOBDB(u.Target).chp, MODFAME+u.cstr
if u.INCOMBAT=1 then dec u.chp, MOBDB(u.Target).cstr
if MOBDB(u.Target).chp<=0
UNTARGETEDTHESEMOBS(u.Target)=u.Target
uWIN=1
u.INCOMBAT=0
u.Target=-1
endif
if w>=4000 then u.INCOMBAT=0
endif
` BATTLE SYSTEM INEFFECTIVELY BROKEN UNRENEW THEN RENEW - later Chris.
//for z=0 to 9 step 1
//if MOBS(z).chp>0 and scancode()=33 and u.x=MOBS(z).x and u.y=MOBS(z).y then u.Target=z
//if MOBS(z).chp>0 and u.z=2 then u.Target=z
//next i
//if u.Target>=0 and u.Target<=array count(MOBDB(0)) then mobsalive=1
`if u.INCOMBAT=1
`whos turn
`ITEMS use or not
`if u.chp<=0 then INCOMBAT=0
`if u.WEP.power>0 and INCOMBAT=1
`TOTALDAMAGE=MODFAME+u.cstr+u.WEP.power
`TOTALHEAL=0
`endif
`if INCOMBAT=0 and TOTALHEAL=0 and TOTALDAMAGE=0
`TOTALDAMAGE=MODFAME+u.cstr
`TOTALHEAL=0
`endif
`if u.INCOMBAT=1 and u.WEP.power<0
`TOTALHEAL=u.mhp
`TOTALDAMAGE=0
`endif
`if TOTALHEAL>0
`if TWHICH=1 then inc u.chp, TOTALHEAL
`//if TWHICH=2 then inc MOBDB(u.Target).chp, TOTALHEAL
`endif
`if TOTALDAMAGE>0
`if UWHICH=1 then dec u.chp, TOTALDAMAGE
//if UWHICH=2 then dec MOBDB(u.Target.chp), TOTALDAMAGE
`endif
`if u.chp>0 and mobsalive=1 then u.INCOMBAT=1 else u.INCOMBAT=0
`endif
`if UWHICH<>1 and UWHICH<>2 then UWHICH=0
`if TWHICH<>1 and TWHICH<>2 then TWHICH=0
//place bar sprite cover sprite with black/bg image sprite
sync
loop
ActMenu:
//MOUSECLICK LEFT to enter ActMenu press f on keyboard to exit ActMenu
Count#=timer()
local ITEMSEL as integer
ITEMSEL=0
repeat
cls
CT#=timer()-Count#
//code for 0 1 2
if ki<=0 then ki=0
if ki>=3 then ki=0
//END code FOR 0 1 2
if upkey()=1 and CT#>999 then UK=1
if UK=1
inc ki, 1
Count#=timer()
UK=0
endif
if downkey()=1 and ki>0 and CT#>999 then DK=1
if DK=1
dec ki, 1
Count#=timer()
DK=0
endif
if keystate(33)=1 then ITEMSEL=1
print str$(ki)
sync
until ITEMSEL=1
WANTMENU=1
ITEMSEL=0
RETURN
BuySellMenu:
Co#=timer()
local ITEMSE as integer
ITEMSE=0
repeat
cls
C#=timer()-Co#
//code for 0 1 2
if ko<=0 then ko=0
if ko>=(1+array count(WEPITEMDB(0))) then ko=0
//END code FOR 0 1 2
if upkey()=1 and C#>999 then UK=1
if UK=1
inc ko, 1
Co#=timer()
UK=0
endif
if downkey()=1 and ki>0 and C#>999 then DK=1
if DK=1
dec ko, 1
Co#=timer()
DK=0
endif
if keystate(33)=1 then ITEMSE=1
print str$(ko)
sync
until ITEMSE=1
WM=1
ITEMSE=0
RETURN
//SHOP IN PROGRESS / MAY NOT WORK
SHOPmenu:
Coed#=timer()
local ITE as integer
ITE=0
repeat
cls
Cod#=timer()-Coed#
if k<=0 then k=0
if k>=1+array count(WEPITEMDB(0)) then k=0
if upkey()=1 and C#>999 then UK=1
if UK=1
inc k, 1
Coed#=timer()
UK=0
endif
if downkey()=1 and k>0 and Cod#>999 then DK=1
if DK=1
dec k, 1
Coed#=timer()
DK=0
endif
print str$(k) + " " + WEPITEMDB(k).name$
if keystate(33)=1 then ITE=1
sync
until ITE=1
uWEPITEMINVENTORY(FindFreeSpaceA())=WEPITEMDB(k)
WM=1
ITE=0
RETURN
function FindFreeSpaceA()
for i=0 to array count(uWEPITEMINVENTORY(0))
if uWEPITEMINVENTORY(i).isAvalible=0 then ret=i
if uWEPITEMINVENTORY(ret).isAvalible=0 then exit
next i
endfunction ret
//PLAYERMOVE:
//START CHUNK
//if u.x>=0 then u.x=0
//if u.x<0 then u.x=0
//ENDCHUNK
//ZERO OUTS!
//RETURN
//Perfect Balance in a=b
function GETHILO( a as integer , b as integer )
if a<b then z=1
if b<a then z=2
if a=b then z=3
if z=1 then ret=rnd(b-a)
if z=2 then ret=rnd(b-a)
if z=3 then ret=rnd(b+a)
if ret=0 then ret=rnd(c)
if ret=0 then ret=rnd(c)
if ret=0 then ret=rnd(c)
endfunction ret
//ENDPERFECT
function GetDist( a as integer , b as integer , c as integer , d as integer )
dx# = a - c
dy# = b - d
dx# = dx# * dx#: dy# = dy# * dy#
dist# = dx# + dy#
endfunction dist#
This Is For Us. We Stand Strong Against Nothing, but time. Let us stand and Play Video Games