Hi guys,
I'm working on a small game, only made with code, no media.
Hope it work.
Enjoy !
Rem Project: Alice Tea Pot
Rem Created: Monday, January 14, 2013
Rem Sébastien Leroux #1GAM Janvier 2013
Rem ***** Main Source File *****
//set display mode 1920,1080,32,1
//set window off
set display mode 1024,786,32,1
reload display pointer
SET IMAGE COLORKEY 0, 0, 0
sync on
sync rate 180
color backdrop rgb(58,84,105)
global g_D3DX9, g_pD3DDevice, g_pMesh, g_pFont, g_pFace
g_D3DX9 = GetFreeDLL()
load dll "d3dx9_42.dll", g_D3DX9
dbpsetup = GetFreeDLL()
load dll "dbprosetupdebug.dll", dbpsetup
g_pD3DDevice = call dll(dbpsetup, "?GetDirect3DDevice@@YAPAUIDirect3DDevice9@@XZ")
delete dll dbpsetup
g_pMesh = make memory(4)
g_pFont = make memory(56)
g_pFace = make memory(32)
//Init
Global GameTitle as string : GameTitle = "Alice tea pot"
//Globals
Global arrow_texture = 9
Global bg_loading = 10
Global ai_texture = 11
global particule = 12
Global HP = 1
//Obj
Global Cube01 = 10
global Sphere
global Sphere2
global terra
global terra2
Global jump = 0
global color_lvl = 255
global color = 1
global Final=0
global Score=0
global Speed=0
global ai_sphere
menu()
repeat
ink rgb(30,30,30)
set text size 64
txt_W = text width ("Play")
text window width()/2-txt_W/2,166,"Play"
sync
UNTIL mouseclick()=1
cls
bg()
sync
delete sprite 2
delete sprite 3
delete sprite bt_play
//delete sprite bt_exit
nbr_obj = 0
make camera 1
xrotate camera 1,65
color backdrop 1,rgb(60,80,140)
set camera range 1,1,8000
fog on
fog distance 1200
fog color rgb(60,80,140)
set ambient light 70
color ambient light rgb(60,80,140)
make light 1
point light 1,0,30,100
color light 1,rgb(60,80,140)
set light range 1,900
Perso_texture()
make object sphere 3,12,32,32
color object 3,rgb(241,154,18)
position object 3,0,10,90
set object specular 3,rgb(255,255,255)
set blend mapping on 3,ai_texture,5
CloudsTexture()
Sphere = find free object()
make object sphere Sphere,-8000,16,16
position object Sphere, camera position x(1),camera position y(1),camera position z(1)
texture object Sphere,0,3
set object fog Sphere,0
set object collision off Sphere
Sphere2 = find free object()
clone object Sphere2,Sphere
scale object Sphere2,30,30,30
ghost object on Sphere2,5
set object collision off Sphere2
set object diffuse Sphere2,rgb(155,255,120)
WorldTexture()
y=0
//floor
lvl()
Wall = find free object()
make object box Wall,14,2,20
for i=0 to 800
Obj = find free object()
clone object Obj,Wall
zrotate object Obj,-45
position object Obj,-20,10,i*30+10
if y > 2
scale object Obj,400,120,100
if color = 1 then color object Obj, rgb(color_lvl-i*10,0,0)
if color = 2 then color object Obj, rgb(0,color_lvl-i*10,0)
if color = 3 then color object Obj, rgb(0,0,color_lvl-i*10)
if color_lvl < 100 and color = 1 then color_lvl = 255 : color = 2
if color_lvl < 100 and color = 2 then color_lvl = 255 : color = 3
y=1
set blend mapping on Obj,ai_texture,8
set object specular Obj,rgb(255,255,255)
else
scale object Obj,100,400,140
texture object Obj,2
ghost object on Obj,3
yrotate object Obj,-10
set object smoothing Obj,100
set object specular Obj,rgb(50,50,50)
set blend mapping on Obj,ai_texture,9
endif
y=y+1
set object collision off Obj
next
for i=0 to 800
Obj = find free object()
clone object Obj,Wall
zrotate object Obj,45
position object Obj,20,10,i*30+10
if y > 2
scale object Obj,400,120,100
if color = 1 then color object Obj, rgb(color_lvl-i*10,0,0)
if color = 2 then color object Obj, rgb(0,color_lvl-i*10,0)
if color = 3 then color object Obj, rgb(0,0,color_lvl-i*10)
if color_lvl < 100 and color = 1 then color_lvl = 255 : color = 2
if color_lvl < 100 and color = 2 then color_lvl = 255 : color = 3
y=1
set blend mapping on Obj,ai_texture,8
set object specular Obj,rgb(255,255,255)
else
scale object Obj,100,400,140
texture object Obj,2
ghost object on Obj,3
yrotate object Obj,10
set object smoothing Obj,100
set object specular Obj,rgb(50,50,50)
set blend mapping on Obj,ai_texture,9
endif
y=y+1
set object collision off Obj
next
Colonne()
global HP_lvl = 600
sprite HP,10,10,6
flip sprite HP
size sprite HP,HP_lvl,40
objBox = find free object()
make object box objBox,30,800,30
for i=0 to 60
Obj = find free object()
clone object Obj,objBox
position object Obj,-100,-100,i*400
zrotate object Obj,20
texture object Obj,4
set sphere mapping on Obj,3
set object smoothing Obj,100
set object collision off Obj
set blend mapping on Obj,1,ai_texture,0,9
scale object texture Obj,1,1,4
next
for i=0 to 60
Obj = find free object()
clone object Obj,objBox
position object Obj,100,-100,i*400
zrotate object Obj,-20
texture object Obj,4
set sphere mapping on Obj,3
set object smoothing Obj,100
Final= i*400
set object collision off Obj
set blend mapping on Obj,1,ai_texture,0,9
scale object texture Obj,1,1,4
next
delete object 9000
Obj = find free object()
make object box Obj,600,60,20
position object Obj,0,120,Final-10
set object specular Obj,rgb(255,255,255)
set object collision off Obj
Obj_finish = find free object()
make object box Obj_finish,40,600,20
position object Obj_finish,0,120,Final
ghost object on Obj_finish,3
set object specular Obj,rgb(255,255,255)
Obj = find free object()
make object box Obj,4,4,Final*2
position object Obj,-220,230,0
set object light Obj,0
set object collision off Obj
set blend mapping on Obj,ai_texture,8
Obj2 = find free object()
clone object Obj2,Obj
position object Obj2,-160,70,0
set object light Obj2,0
set object collision off Obj2
set blend mapping on Obj2,ai_texture,8
Obj2 = find free object()
clone object Obj2,Obj
position object Obj2,220,230,0
set object light Obj2,0
set object collision off Obj2
Obj2 = find free object()
clone object Obj2,Obj
position object Obj2,160,70,0
set object light Obj2,0
set object collision off Obj2
terra = find free object()
make object sphere terra,2000,32,32
ghost object on terra,2
set object collision off terra
terra2 = find free object()
clone object terra2,terra
set object collision off terra2
set object diffuse terra2,rgb(255,0,0)
scale object terra2,101,101,101
texture object terra2,0,8
ghost object on terra2,4
set blend mapping on terra2,1,ai_texture,0,9
for i=0 to 20
Satelite = find free object()
MakeObjectTeapot(Satelite)
scale object Satelite,6000,6000,6000
position object Satelite,-400+rnd(30),rnd(260)-60,rnd(Final)
texture object Satelite,5
yrotate object Satelite,rnd(90)
set object specular Satelite,rgb(255,255,255)
set object collision off Satelite
next
for i=0 to 20
Satelite = find free object()
MakeObjectTeapot(Satelite)
scale object Satelite,6000,6000,6000
position object Satelite,400+rnd(30),rnd(260)-60,rnd(Final)
texture object Satelite,5
zrotate object Satelite,rnd(90)
set object specular Satelite,rgb(255,255,255)
set object collision off Satelite
next
//Particles
make particles 1,particule,10,8.0
rotate particles 1,-90,0,0
set particle life 1,40
color particles 1,2,6,255
cloudRotate2# as float : cloudRotate2# = 0
cloudScale# as float : cloudScale# = 0
MapSize=4
Segments=64
global gravity# as float
hide mouse
//DO ---------------------------------------------------------------------------------------------------------------------------------------------
do
position light 1,camera position x(1),camera position y(1)+30,camera position z(1)+100
if Speed > 1 then move object 3,0.4
if Speed > 60 then move object 3,0.5
if Speed > 100 then move object 3,0.6
if Speed > 280 then move object 3,0.8
if Speed > 600 then move object 3,1.2
if Speed > 900 then move object 3,1.8
if Speed > 1200 then move object 3,2.0
if Speed > 1600 then move object 3,2.4
if Speed > 1900 then move object 3,2.6
position camera 1,object position x(3),object position y(3)+30,object position z(3)-80
position object Sphere, camera position x(1),camera position y(1),camera position z(1)
position object Sphere2, camera position x(1),camera position y(1),camera position z(1)
position object terra, camera position x(1),-1100,camera position z(1)+800
position object terra2, camera position x(1),-1100,camera position z(1)+800
position particles 1,object position x(3),object position y(3),object position z(3)-2
set particle velocity 1,Speed/80+10
set camera to object orientation 1,3
yrotate object Sphere,cloudRotate#
cloudRotate# =wrapvalue(cloudRotate#-0.04)
yrotate object Sphere2,cloudRotate2#
cloudRotate2# =wrapvalue(cloudRotate2#+0.04)
yrotate object terra2,cloudRotate2#*10
MoveMan(3)
PerformGravity(3)
if object collision(3,0) > 0
if HP_lvl > 1
set sprite diffuse HP,220,100,100
HP_lvl=HP_lvl-40
if Score > 0 then Score=Score-60
size sprite HP,HP_lvl,40
else
GameOver()
endif
else
set sprite diffuse HP,255,255,255
endif
if object collision(3,Obj_finish) > 0 then Win()
Score=Score+1
Speed=Speed+1
set text size 60
txt_W2 = text width (str$(Score))
ink rgb(0,0,30)
text window width()/2-txt_W2/2+3,60+3, str$(Score)
ink rgb(255,255,255)
text window width()/2-txt_W2/2,60, str$(Score)
text 10,120, str$(screen fps())
fastsync
loop
//FUNCTIONS --------------------------------------------------------------------------------------------------------------------------------
function lvl()
make object box Cube01,14,2,20
for i=0 to 800
Obj = find free object()
clone object Obj,Cube01
read obstacle
select obstacle
case 1
position object Obj,0,0,i*30+10
scale object Obj, 140,896,90
color object Obj, rgb(50,50,105)
set object ambient Obj,0
ghost object on Obj,5
set object specular Obj,rgb(0,255,0)
set object smoothing Obj,20
endcase
case 2
position object Obj,0,14,i*30+10
scale object Obj, 140,840,90
color object Obj, rgb(50,50,105)
set object ambient Obj,0
ghost object on Obj,5
set object specular Obj,rgb(255,0,0)
set object smoothing Obj,20
Obj2 = find free object(1000,6000)
clone object Obj2,Cube01
position object Obj2,0,0,i*30+10
texture object Obj2,2
ghost object on Obj2,3
set object collision off Obj2
endcase
case 0
position object Obj,0,0,i*30+10
texture object Obj,2
ghost object on Obj,3
set object collision off Obj
endcase
endselect
next
endfunction
function MoveMan(objNum)
if upkey()=1
scale object objnum,90,120,90
if object position y(objnum)<=object size y(3)/2
gravity#=-2.500
endif
MOVE OBJECT up objnum,0.4
else
scale object objnum,100,100,100
endif
if downkey()=1
scale object objnum,140,60,140
position object objnum, object position x(objnum),2,object position z(objnum)
else
scale object objnum,100,100,100
endif
endfunction
function PerformGravity(ObjNum)
if downkey()=1 then exitfunction
Plrx#=object position x(ObjNum)
Plry#=object position y(ObjNum)
Plrz#=object position z(ObjNum)
if Plry#>object size y(3)/2
dec Plry#,gravity#
inc gravity#,0.250
else
Plry#= object size y(3)/2
gravity#=0
endif
position object ObjNum,Plrx#,Plry#,Plrz#
endfunction
function RS_Game()
show sprite HP
position camera 1,0,0,0
position object 3,0,10,90
position object Sphere, camera position x(1),camera position y(1),camera position z(1)
position object Sphere2, camera position x(1),camera position y(1),camera position z(1)
position object terra, camera position x(1),camera position y(1),camera position z(1)+1600
position object terra2, camera position x(1),camera position y(1),camera position z(1)+1800
HP_lvl= 600
size sprite HP,HP_lvl,40
set text size 72
Score=0
Speed=0
endfunction
function GameOver()
ink rgb(255,255,255),rgb(60,60,80)
cls
hide sprite HP
position camera 1,0,10000,0
position object Sphere, camera position x(1),camera position y(1),camera position z(1)
position object Sphere2, camera position x(1),camera position y(1),camera position z(1)
position object terra, camera position x(1),camera position y(1),camera position z(1)+1600
position object terra2, camera position x(1),camera position y(1),camera position z(1)+1800
repeat
txt_W = text width ("Game Over")
text window width()/2-txt_W/2,window height()/2-100, "Game Over"
sync
until returnkey()=1 or spacekey()=1 or mouseclick()=1
RS_Game()
ENDFUNCTION
function Win()
ink rgb(255,255,255),rgb(60,60,80)
cls
hide sprite HP
position camera 1,0,10000,0
position object Sphere, camera position x(1),camera position y(1),camera position z(1)
position object Sphere2, camera position x(1),camera position y(1),camera position z(1)
position object terra, camera position x(1),camera position y(1),camera position z(1)+1600
position object terra2, camera position x(1),camera position y(1),camera position z(1)+1800
repeat
set text size 72
txt_W = text width ("You Win!")
ink rgb(255,255,255)
text window width()/2-txt_W/2,window height()/2-100, "You Win!"
set text size 130
color = rnd(55)
ink rgb(200+color,200+color,55+color)
txt_W2 = text width (str$(Score))
text window width()/2-txt_W2/2,window height()/2+100, str$(Score)
yrotate object Sphere,cloudRotate#
cloudRotate# =wrapvalue(cloudRotate#-0.06)
yrotate object Sphere2,cloudRotate2#
cloudRotate2# =wrapvalue(cloudRotate2#+0.06)
yrotate object terra2,cloudRotate2#*Score/100
sync
until returnkey()=1 or spacekey()=1 or mouseclick()=1
//lvl()
sync
RS_Game()
endfunction
function CloudsTexture()
cls
for x=0 to 512
for y=0 to 24
color_rnd = y
cloud= rnd(40)
dot x,y,rgb(111+cloud,204+cloud,199+cloud)
next
next
get image 3,0,0,512,24
endfunction
function WorldTexture()
cls
for x=0 to 32
for y=0 to 32
color_rnd = y
cloud= rnd(40)
dot x,y,rgb(cloud*4,204+cloud,149+cloud)
next
next
get image 2,0,0,32,32
endfunction
function Perso_texture()
for y=10 to 256 step 2
for x=10 to 256 step 2
pxl= rnd(155)
dot x,y,rgb(pxl,pxl,pxl+100)
next
next
get image ai_texture,60,100,256,256
get image particule,0,0,1,1
endfunction
function Colonne()
cls
for x=0 to 16
for y=0 to 512
rnd_color= rnd(60)
dot x,y,rgb(y-20,20,y/2+rnd_color)
next
next
for x=0 to 512
for y=40 to 128
color_rnd = y
cloud= rnd(40)
if y=40 or y=128
dot x,y,rgb(42,235,242)
else
dot x,y,rgb(y*2,235,y)
endif
next
next
get image 4,0,0,16,512
get image 5,0,40,16,128
get image 6,0,40,512,90
endfunction
function menu()
cls
for x=0 to 512
for y=0 to 128
if x < 256
dot x,y,rgb(x,x,x)
else
dot x,y,rgb(255-x,255-x,255-x)
endif
next
next
get image 7,0,0,512,128
cls
sprite 2,0,0,7
set sprite diffuse 2,46,90,125
size sprite 2,window width(),window height()
for x=0 to window width()
for y=0 to 200
dot x,y,rgb(255-y,255-y,255-y)
next
next
get image 9,0,0,window width(),200
cls
Global bt_Play=4
sprite bt_Play,300,242,9
size sprite bt_Play,window width()-600,80
set sprite alpha bt_Play,80
txt_W = text width ("Play")
set text size 70
text window width()/2-txt_W,244,"Play"
//Global bt_exit=5
//clone sprite bt_Play,bt_exit
//paste sprite bt_exit,300,340
ink rgb(30,30,30)
set text size 110
txt_W = text width (GameTitle)
text window width()/2-txt_W/2,66,GameTitle
ink rgb(255,199,111)
text window width()/2-txt_W/2,60,GameTitle
ink rgb(241,154,18)
text window width()/2-txt_W/2,62,GameTitle
ink rgb(58,84,105)
line 0,200,window width(),200
ink rgb(108,172,223)
line 0,202,window width(),202
ink rgb(30,30,30)
box 0,0,window width(),40
box 0,0,window width(),40
get image 8,0,0,window width(),window height()
sprite 3,0,0,8
size sprite 3,window width(),window height()
//delete sprite 2 : delete image 7
endfunction
function bg()
for x=0 to 512
for y=0 to 128
if x < 256
dot x,y,rgb(x,x,x)
else
dot x,y,rgb(255-x,255-x,255-x)
endif
next
next
get image bg_loading,0,0,512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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1
function FreeD3D()
delete dll g_D3DX9
delete memory g_pMesh
delete memory g_pFont
delete memory g_pFace
endfunction
function MakeObjectBox(object, width#, height#, depth#)
call dll g_D3DX9, "D3DXCreateBox", g_pD3DDevice, width#, height#, depth#, g_pMesh, 0
CreateObject(object)
endfunction
function MakeObjectCylinder(object, radius1#, radius2#, length#, slices, stacks)
call dll g_D3DX9, "D3DXCreateCylinder", g_pD3DDevice, radius1#, radius2#, length#, slices, stacks, g_pMesh, 0
CreateObject(object)
endfunction
function MakeObjectPolygon(object, length#, sides)
call dll g_D3DX9, "D3DXCreatePolygon", g_pD3DDevice, length#, sides, g_pMesh, 0
CreateObject(object)
set object cull object, 0
endfunction
function MakeObjectSphere(object, radius#, slices, stacks)
call dll g_D3DX9, "D3DXCreateSphere", g_pD3DDevice, radius#, slices, stacks, g_pMesh, 0
CreateObject(object)
endfunction
function MakeObjectTeapot(object)
call dll g_D3DX9, "D3DXCreateTeapot", g_pD3DDevice, g_pMesh, 0
CreateObject(object)
endfunction
function MakeObjectTorus(object, radius1#, radius2#, sides, rings)
call dll g_D3DX9, "D3DXCreateTorus", g_pD3DDevice, radius1#, radius2#, sides, rings, g_pMesh, 0
CreateObject(object)
endfunction
function Set3DTextFont(font$, bold, italic, charset)
restore FontDefault
p = g_pFace
for i = 1 to len(font$)
*p = asc(mid$(font$, i))
inc p
next i
p = g_pFont
for i = 1 to 13
read d : *p = d : inc p, 4
next i
*p = g_pFace
if bold then p = g_pFont + 16 : *p = 700
if italic then p = g_pFont + 20 : *p = 1
p = g_pFont + 32 : *p = charset
FontDefault:
data 0, 0, 0, 0, 400, 0, 0, 0, 1, 7, 0, 4, 0
endfunction
function MakeObject3DText(object, text$, deviation#, extrusion#)
user32 = GetFreeDLL()
load dll "user32.dll", user32
hWin = call dll(user32, "GetActiveWindow")
hDC = call dll(user32, "GetDC", hWin)
gdi32 = GetFreeDLL()
load dll "gdi32.dll", gdi32
hFont = call dll x(gdi32, "CreateFontA", g_pFont, 14)
call dll gdi32, "SelectObject", hDC, hFont
call dll g_D3DX9, "D3DXCreateTextA", g_pD3DDevice, hDC, text$, deviation#, extrusion#, g_pMesh, 0, 0
call dll gdi32, "DeleteObject", hFont
call dll user32, "ReleaseDC", hWin, hDC
delete dll user32
delete dll gdi32
CreateObject(object)
endfunction
function CreateObject(object)
call dll g_D3DX9, "D3DXSaveMeshToXA", str$(*g_pMesh), *g_pMesh, 0, 0, 0, 0, 0
mesh = GetFreeMesh()
load mesh str$(*g_pMesh), mesh
make object object, mesh, 0
delete file str$(*g_pMesh)
delete mesh mesh
endfunction
function GetFreeDLL()
for i = 255 to 1 step -1
if not dll exist(i) then exit
next i
endfunction i
function GetFreeMesh()
for i = 65535 to 1 step -1
if not mesh exist(i) then exit
next i
endfunction i
