Hi all,
As somepeople know, i'm from french forum !
I'm here to present you my programs,
First, i would like to show you a Snake :
`***** Snake III ****
`***** By T£RSAKEN ****
`**************************
`Initialisation.
Set Display Mode 640,480,16
Sync On : Sync Rate 30 : Hide Mouse
Randomize Timer()
`Variables
Global Max = 4
Global Sens = 1
Global Score = 0
Global Bonus_Actif = 0
Type Positions
X as Integer
Y as Integer
EndType
Dim Serpent(99) as Positions
Global Bonus as Positions
Gosub _Ciel
`Boucle Principale.
Do
Cls
Bonus()
controle()
deplacement()
Display()
wait 50
Sync
Loop
`Fonctions.
function controle()
`Commande joueurs.
if upkey() and sens <> 3 : Sens = 2 : exitfunction : endif
if downkey() and sens <> 2 : Sens = 3 : exitfunction : endif
if leftkey() and sens <> 1 : Sens = 0 : exitfunction : endif
if rightkey() and sens <> 0 : Sens = 1 : exitfunction : endif
endfunction 0
Function deplacement()
`Deplacement serpent
Select Sens
case 0 : dec serpent(0).x,16 : endcase : `Gauche.
case 1 : inc serpent(0).x,16 : endcase : `Droite.
case 2 : dec serpent(0).y,16 : endcase : `Haut.
case 3 : inc serpent(0).y,16 : endcase : `Bas.
endselect
`Limites terrains.
if serpent(0).y < 0 : serpent(0).y = 464 : endif
if serpent(0).y > 480 : serpent(0).y = 0 : endif
if serpent(0).x < 0 : serpent(0).x = 624 : endif
if serpent(0).x > 640 : serpent(0).x = 16 : endif
`Collisions.
if serpent(0).x = bonus.x*16
if serpent(0).y = bonus.y*16
Inc Score,10 : Bonus_Actif = 0
Inc Max,1
endif
endif
`Mort.
for xloop = 1 to max
if serpent(0).x = serpent(xloop).x and serpent(0).y = serpent(xloop).y
end
endif
next xloop
endfunction 0
Function Display()
`Gestion de la queue.
for x = max to 1 step - 1
serpent(x).x = serpent(x-1).x
serpent(x).y = serpent(x-1).y
Next x
paste image 1,0,0 : `On affiche le ciel.
`On affiche le serpent.
ink rgb(255,255,0),0
for x = 1 to max
box Serpent(x).x,serpent(x).y,serpent(x).x+16,serpent(x).y+16
next x
`La Tête du serpent.
ink rgb(255,0,0),0 : box Serpent(0).x,serpent(0).y,serpent(0).x+16,serpent(0).y+16
`Le Bonus.
ink rgb(0,0,125),0 : box bonus.x*16,bonus.y*16,bonus.x*16+16,bonus.y*16+16
`Le Score.
ink rgb(0,255,0),0 : set cursor 10,10 : Print " Score : ",Score
endfunction 0
Function Bonus()
if Bonus_Actif = 0
Bonus.x = rnd(19) : Bonus.y = rnd(14)
Bonus_Actif = 1
endif
endfunction 0
`Etiquettes.
_Ciel:
for xloop = 0 to 350
dot rnd(640),rnd(480)
next xloop
get image 1,0,0,640,480
return
I'm making a Frogger, but if you want to have a look on my code , it's here :
Rem Dark Basic Professional Project: frogger
Rem Created: 21/01/2004 18:05:25
Rem Author: T£rsAk£n
Rem E-Mail: [email protected]
Rem Web Site:
`***************
`Initialisation.
`***************
Set Display Mode 640,480,16
Sync On : Sync Rate 30
Hide Mouse
Randomize timer()
`Variables
`Types.
Type Position
x as integer
y as integer
endtype
Dim Map(40,30)
Global Vitesse = 1
Global Niveau = 2
Global Perso as Position
Map_Generator()
`Boucle Principale
Do
Cls
Controle()
Deplacements()
Affiche()
wait 75
Sync
Loop
`Fonctions
Function Controle()
inc Perso.y,(downkey() - upkey() )
inc perso.x,(rightkey() - leftkey())
`Collisions
if perso.x < 1 : perso.x = 1 : endif
if perso.x > 38 : perso.x = 38 : endif
if perso.y < 0 : perso.y = 0 : endif
if map(perso.x,perso.y) <> 0 : perso.x = 1 : perso.y = 0 : endif
`Victoire
if perso.y > 28 : Inc Niveau,1 : Map_Generator() : perso.x = 1 : perso.y = 0 : endif
endfunction 0
Function Deplacements()
for yloop = 0 to 29 : for xloop = 0 to 39
if map(xloop,yloop) <> 0
map(xloop-Vitesse,yloop) = map(xloop,yloop) : map(xloop,yloop) = 0
endif
if map(0,yloop) <> 0 : map(39,yloop) = map(0,yloop) : map(0,yloop) = 0 : endif
next xloop : next yloop
endfunction 0
Function Vehicule(x,y,size,color)
for xloop = x to x + size
Map(xloop,y) = color
next xloop
endfunction 0
Function Affiche()
for yloop = 0 to 29 : for xloop = 0 to 39
if map(xloop,yloop) <> 0
ink map(xloop,yloop),0 : box xloop*16,yloop*16,xloop*16+16,yloop*16+16
endif
next xloop : next yloop
ink rgb(0,0,255),0 : box perso.x*16,perso.y*16,perso.x*16+16,perso.y*16+16
`Interface
ink rgb(255,0,0),0 : Box 0,0,16,480 : box 624,0,640,480
ink rgb(255,255,255),0 : set cursor 564,460 : print " Niveau ",Niveau - 2
endfunction 0
`Generateur de Niveau aléatoire.
Function Map_Generator()
for yloop = 1 to 28 step 2
for zloop = 0 to Niveau
vehicule(rnd(39),yloop,rnd(2)+1,rgb(rnd(125),rnd(125),rnd(125)))
next zloop
next yloop
endfunction 0
`Etiquettes
Third, this is my own Game " Fully ", the goal of this soft : full the screen ; I can't say something anymore
`-----------------------------
`-- Author : T€RS@K€N --------
`-----------------------------
`Initialisation
if check display mode(640,480,16) : set display mode 640,480,16 : else : end: endif
Hide Mouse : `On cache la Souris.
Sync On : Sync Rate 30
Disable escapekey
`Variables.
Dim Map(20,15) : Dim Player(2)
`Globales
Global Niveau
Goto Menu : `On Lance le Menu.
Jeu:
Set Text Font "Arial"
Set text size 12
Load_Stage(0) : ` Chargement du Niveau.
`====================
`====== Jeu =========
`====================
`Boucle Principale
Do
Cls
Controle()
Affichage()
Sync
Loop
`Fonctions
Function Controle()
If EscapeKey() : goto Menu : endif
If ReturnKey() : Load_Stage(Niveau) : endif
If Upkey() : Collision(0,-1) : Direction = 1 : endif
If DownKey() : Collision(0, 1) : Direction = 1 : endif
If Direction = 0
if LeftKey() : Collision(-1,0) : endif
if RightKey() : Collision( 1,0) : endif
endif
collision(0,0) : `On verifie les coordonnées du personnage.
endfunction 0 : `Ne renvoi rien.
function Affichage()
for y = 0 to 13 : for x = 0 to 18
if Map(x,y) = 1 : Ink Rgb(255,0,0),0 : Box x*32,y*32,x*32+32,y*32+32 : endif
if Map(x,y) = 3 : Ink Rgb(255,255,0),0 : Box x*32,y*32,x*32+32,y*32+32 : endif
` Condition de Victoire : Le Tableau doit être rempli.
if Map(x,y) <> 0 : Inc Compteur,1 : endif
next x : next y
If Compteur > 265 : inc Niveau,1 : Load_Stage(Niveau) : endif
`Puis on affiche la grille.
for x = 0 to 18 : for y = 0 to 13
ink rgb(125,125,125),0
line x*32,0,x*32,448
line 0,y*32,608,y*32
next y : next x
`Ensuite le heros
Box Player(0)*32,Player(1)*32,Player(0)*32+32,Player(1)*32+32
`Et Enfin L'interface du jeu
set cursor 10,460 : print " Niveau ",Niveau+1," Entrée pour reintialiser la carte " ;
Print "Fps : ",screen fps()
endfunction 0
function Load_Stage(Stage)
Select Stage
Case 0 : restore Niveau_1 : endcase
Case 1 : restore Niveau_2 : endcase
case 2 : restore Niveau_3 : endcase
case 3 : goto Credits : endcase
endselect
`Lecture des Datas.
for y = 0 to 13 : for x = 0 to 18
read map(x,y)
If Map(x,y) = 2 : Player(0) = x : Player(1) = y : endif
next x : next y
endfunction 0
Function Collision(x,y)
If Player(0) <= 0 : Player(0) = 0 : endif
If Player(0) >= 18 : Player(0) = 18 : endif
if Player(1) <= 0 : Player(1) = 0 : endif
if player(1) >= 13 : Player(1) = 13 : endif
Touche = Scancode()
If Touche <> 0
if Map(Player(0)+x,Player(1)+y) = 0
Map(Player(0),Player(1)) = 3
Inc Player(0),x : Inc Player(1),y
Map(Player(0),Player(1)) = 2
endif
wait 50
endif
endfunction 0
Function Texte(Texte$,x,y,couleur)
set cursor x,y : ink couleur,0
print Texte$
endfunction
`Les Niveaux sont stockés dans des Datas.
`Niveau 1.
Niveau_1:
Data 2,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0
Data 0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0
Data 0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0
Data 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0
Data 0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
Data 0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,0,0,0,0,1,1
Data 0,0,1,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1
Data 0,0,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1
Data 0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1
Data 0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,1,1
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1
Data 0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,1,1
Data 0,0,0,1,0,0,0,0,1,1,1,0,0,0,0,0,0,1,1
Data 0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,1,1
Data 0,0,0,0,1,0,0,0,1,1,1,0,0,0,0,0,0,1,1
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,1
Data 0,1,1,0,0,0,0,0,0,1,1,1,0,1,0,1,1,1,1
Data 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1
`============================================
`============ Menu de Jeu ===================
`============================================
Menu:
Set text size 45
Set Text Font "Impact"
Do
Cls
if upkey() : dec Menu,1 : endif
if downkey() : inc Menu,1 : endif
If Menu < 0 : Menu = 1 : endif
If Menu > 1 : Menu = 0 : endif
Texte("Fully By Tersaken.",10,10,rgb(255,255,0))
If Menu = 0
Texte("Start",100,200,rgb(255,0,0))
Texte("Quit",100,300,rgb(255,255,255))
If ReturnKey() : goto jeu : endif
Else
Texte("Start",100,200,rgb(255,255,255))
Texte("Quit",100,300,rgb(255,0,0))
if returnkey() : end : endif
Endif
wait 100
Sync
Loop
`------------------------------------------------
`--------------- Credits de Jeu ------------------
`-------------------------------------------------
Credits:
Y# = 100
Set Text Font "Impact"
Set text size 45
Repeat
Cls
Dec Y#,1
Texte("Credits : ",10,Y#,rgb(125,255,0))
Texte("* ProGrammeur : Tersaken ",10,Y#+60,rgb(255,0,0))
Texte("* Testeurs : Melysoph ",10,Y#+110,rgb(255,0,0))
Texte("* Pour le Concours Global Dark Site ",10,Y#+160,rgb(255,125,0))
Texte("* Merci a la communauté GDS !!",10,Y#+210,rgb(0,255,125))
Sync
Until Y# < - 250
Goto Menu : `On retourne au Menu.
To Finish a simple clock
`Horloge By T£RSAK£N
`Init
Set Display mode 320,240,16
Sync on : sync rate 30
`Boucle.
Do
Cls
Second$ = Right$(Get Time$(),2) : Second = Val(Second$)*6
Minut$ = Mid$(Get time$(),4) + Mid$(Get Time$(),5) : Minut = Val(Minut$)* 6
Heure$ = Left$(Get time$(),2) : Heure = Val(Heure$)* 30
Ink Rgb(255,0,255),0 : Circle 50,50,50
Ink Rgb(0,255,0),0 : Line 50,50,50+45*Cos(Second-90),50+45*Sin(Second-90)
Ink Rgb(0,255,255),0 : Line 50,50,50+37*Cos(Minut-90),50+37*Sin(Minut-90)
Ink Rgb(255,255,0),0 : Line 50,50,50+30*Cos(Heure-90),50+30*Sin(Heure-90)
Ink Rgb(255,255,255),0 : Set Cursor 0,110 : print Heure$, " : ",Minut$," : ",Second$
Sync
Loop
In fact, i'm creating a compilation of old games !
I'm Going to make a Pac-Man, Pong and others ...
Athlon 1700+ ; 256 Mo DDR ; GeForce Fx 5600 128 Mo.