This is the first game I ever made and it ain't bad at all!
````````````````````````````````````````````````````````````````````````````
` RPG GAME
`By:TGWDNGHN
`November 2,2002-November 11,2002
````````````````````````````````````````````````````````````````````````````
`Standarn Initialization
Sync On
Sync Rate 30
Autocam Off
Point Camera 0,0,0
````````````````````````````````````````````````````````````````````````````
`OBJECTS
````````````````````````````````````````````````````````````````````````````
`Load Objects and append animation data
for x=1 to 2
Load Object "Idle.x",x
Append Object "Move.x",x,100
Append Object "Static.x",x,200
Append Object "Impact.x",x,300
Append Object "Die.x",x,400
Append Object "Attack.x",x,500
next x
Load Image "Player1.bmp",1
Load Image "Player2.bmp",2
`Texture Objects
Texture Object 1,1
Texture Object 2,2
`Scale Objects
Scale Object 1,2000,2000,2000
Scale Object 2,2000,2000,2000
`Fix Object Pivots
for x=1 to 2
Yrotate Object x,180
Fix Object Pivot x
next x
`Position Objects
Position Object 1,-100,0,0
Position Object 2,100,0,0
`Animate Objects
Set Object Frame 1,500
Set Object Frame 2,500
Play Object 1,1,25
Loop Object 1,1,25
Play Object 2,1,25
Loop Object 2,1,25
Set Object Speed 1,25
Set Object Speed 2,25
````````````````````````````````````````````````````````````````````````````
`Load Music and Sound
````````````````````````````````````````````````````````````````````````````
Load Music "Battle.mid",1
````````````````````````````````````````````````````````````````````````````
`Set Up Arrays and battle variables
````````````````````````````````````````````````````````````````````````````
`player,HP-MP-FP-MFP-DP-MD-defence?-Speed
dim players(2,8)
dim turn(2,8)
p1turn=0
p2turn=0
p1turnt=50
p2turnt=0
`What so you want to do:Attack,Magic or defend
p1move=0
p2move=0
`Animation State 1-idle,2-move,3-static,4-impact,5-die,6-attack
anip1=0
anip2=1
`Give some default values to the variables
For x=1 to 2
` I like 500 for Health...
Players(x,1)=500
Players(x,2)=10
Players(x,3)=15
`3000 for "testing purposes"...change back to 30 later ;)
Players(x,4)=30
Players(x,5)=9
Players(x,6)=3
Next x
````````````````````````````````````````````````````````````````````````````
`Make Arena
````````````````````````````````````````````````````````````````````````````
Load Image "Floor.bmp",3
Make Matrix 1,1000,1000,25,25
Prepare Matrix Texture 1,3,1,1
Position Matrix 1,-500,0,-500
`Cool Extras ;)
`Ghost Matrix On 1
`Make a space sphere
CLS
Ink 0,0
Box 0,0,640,480
for x=1 to 5000
Ink RGB(rnd(255),rnd(255),rnd(255)),0
dot rnd(640),rnd(480)
next x
Get Image 4,0,0,640,480
CLS
Make Object Sphere 3,-2000
Position Object 3,0,250,0
Texture Object 3,4
Set Object 3,1,1,0,1,0,1,0
Loop Music 1
````````````````````````````````````````````````````````````````````````````
`MAIN LOOP
````````````````````````````````````````````````````````````````````````````
`Restart Label...
New_game:
Loop Music 1
Backdrop on
Players(1,1)=500
Players(2,1)=500
Ghost Object Off 1
Ghost Object Off 2
Texture Object 1,1
Texture Object 2,2
`Main Loop
Do
`Put Title text On the Screen
Ink RGB(255,255,255),0
Center Text 320,0,"RPG Engine"
`Get Object's Current Frame
`Set Cursor 0,100
`Print Object Frame(1)
`**********Whose turn is it?**********
`Battle Menu if its your turn
If p1turn=1
Players(1,7)=0
Fade Object 1,100
while p1move=0
Set Cursor 0,100
Print "Player One"
Print "HP: ";players(1,1)
Print "Attack:1"
Print "Magic:2"
Print "Defense:3"
Print "Health:4"
Print "Magics Left: ",Players(1,2)
If Scancode()=2 then p1move=1
If Scancode()=3 And Players(1,2)>0 then p1move=2
If Scancode()=4 then p1move=3
If Scancode()=5 And Players(1,2)>0 then p1move=4
sync
endwhile
endif
If p2turn=1
Players(2,7)=0
Fade Object 2,100
while p2move=0
Set Cursor 0,100
Print "Player Two"
Print "HP: ";players(2,1)
Print "Attack:1"
Print "Magic:2"
Print "Defense:3"
Print "Health:4"
Print "Magics Left: ",Players(2,2)
If Scancode()=2 then p2move=1
If Scancode()=3 And Players(2,2)>0 then p2move=2
If Scancode()=4 then p2move=3
If Scancode()=5 And Players(2,2)>0 then p2move=4
sync
endwhile
endif
`Battle commands if you selected one
`player 1
If p1turn=1 and p1move=1
If Players(2,7)=0
Players(2,1)=Players(2,1)-Players(1,3)+(rnd(10)-5)+Players(2,5)
else
Players(2,1)=Players(2,1)-(0.5*(Players(1,3)+(rnd(10)-5)+Players(2,5)))
endif
p1turn=0
p1turnt=0
p1move=0
anip1=2
endif
If p1turn=1 and p1move=2
If Players(2,7)=0
Players(2,1)=Players(2,1)-Players(1,4)+(rnd(10)-5)+Players(2,6)
else
Players(2,7)=Players(2,7)-(0.5*(Players(1,4)+(rnd(10)-5)+Players(2,6)))
endif
Players(1,2)=Players(1,2)-1
p1turn=0
p1turnt=0
p1move=0
anip1=7
endif
If p1turn=1 and p1move=3
Players(1,7)=1
p1turn=0
p1turnt=0
p1move=0
anip1=3
endif
If p1turn=1 and p1move=4
Players(1,1)=Players(1,1)+50
If Players(1,1)>500 then Players(1,1)=500
Players(1,2)=Players(1,2)-1
p1turn=0
p1turnt=0
p1move=0
anip1=8
endif
`player 2
If p2turn=1 and p2move=1
If Players(1,7)=0
Players(1,1)=Players(1,1)-Players(2,3)+(rnd(10)-5)+Players(1,5)
else
Players(1,1)=Players(1,1)-(0.5*(Players(2,3)+(rnd(10)-5)+Players(1,5)))
endif
p2turn=0
p2turnt=0
p2move=0
anip2=2
endif
If p2turn=1 and p2move=2
If Players(1,7)=0
Players(1,1)=Players(1,1)-Players(2,4)+(rnd(10)-5)+Players(2,6)
else
Players(1,7)=Players(1,7)-(0.5*(Players(2,4)+(rnd(10)-5)+Players(2,6)))
endif
Players(2,2)=Players(2,2)-1
p2turn=0
p2turnt=0
p2move=0
anip2=7
endif
If p2turn=1 and p2move=3
Players(2,7)=1
p2turn=0
p2turnt=0
p2move=0
anip2=3
endif
If p2turn=1 and p2move=4
Players(2,1)=Players(2,1)+50
If Players(2,1)>500 then Players(2,1)=500
Players(2,2)=Players(2,2)-1
p2turn=0
p2turnt=0
p2move=0
anip2=8
endif
`inc p1turnt and p2turnt (turnt stands for turn time as in waiting)
If p1turn=0 and p2turn=0
inc p1turnt
inc p2turnt
endif
`If its no one's turn and your turnt is up then its your turn
If p1turn=0 and p2turn=0 and p1turnt>=100 Then p1turn=1
If p1turn=0 and p2turn=0 and p2turnt>=100 Then p2turn=1
`Animate the Objects
`Player one
If anip1=1
Set Object Speed 1,25
play object 1,0,25
loop object 1,0,25
Position Object 1,-100,0,0
endif
If anip1=2
Set Object Speed 1,50
play object 1,102,122
loop object 1,102,122
For x=1 to 50
Move Object 1,3
sync
next x
anip1=6
endif
If anip1=3
Fade Object 1,200
else
Fade Object 1,100
endif
If anip1=4
Play Object 1,300,310
While Object Frame(1)=525
anip1=1
anip2=4
endif
If anip1=7
For x=1 to 27
Turn Object Left 1,10
Fade Object 1,x*200+100
sync
Next x
Position Object 1,100,0,0
For x=255 to 511 step 25
Set Gamma x,x,x
next x
sync
anip1=1
Sleep 500
Set Gamma 255,255,255
endif
If anip1=8
For x=1 to 27
Turn Object Left 1,10
Fade Object 1,x*200+100
sync
Next x
For x=255 to 511 step 25
Set Gamma x,x,x
next x
For x=511 to 255 step -25
Set Gamma x,x,x
next x
sync
anip1=1
Sleep 500
endif
`Player two
If anip2=1
Set Object Speed 2,25
play object 2,0,25
loop object 2,0,25
Position Object 2,100,0,0
endif
If anip2=2
Set Object Speed 2,50
play object 2,102,122
loop object 2,102,122
For x=1 to 50
Move Object 2,3
sync
next x
anip2=6
endif
If anip2=3
Fade Object 2,200
else
Fade Object 2,100
endif
If anip2=4
Play Object 2,300,310
While Object Frame(2)=525
anip2=1
anip1=4
endif
If anip2=7
For x=1 to 27
Turn Object Left 2,10
Fade Object 2,x*200+100
sync
Next x
Position Object 2,-100,0,0
For x=255 to 511 step 25
Set Gamma x,x,x
next x
sync
anip2=1
Sleep 500
Set Gamma 255,255,255
endif
If anip2=8
For x=1 to 27
Turn Object Left 2,10
Fade Object 2,x*200+100
sync
Next x
For x=255 to 511 step 25
Set Gamma x,x,x
next x
For x=511 to 255 step -25
Set Gamma x,x,x
next x
sync
anip2=1
Sleep 500
endif
`Are You Dead Yet?
If Players(1,1)360 then hca#=1
vca#=22.5
dist#=300
object#=1
`Rotate Camera Around The Areana
Gosub Move_Camera
Point Camera 0,0,0
Point Object 1,Object Position X(2),Object Position Y(2),Object Position Z(2)
Point Object 2,Object Position X(1),Object Position Y(1),Object Position Z(1)
Sync
Loop
````````````````````````````````````````````````````````````````````````````
`Sub routines
````````````````````````````````````````````````````````````````````````````
Move_Camera:
Polar_Camera(centerx#,centery#,centerz#,hca#,vca#,dist#)
Return
````````````````````````````````````````````````````````````````````````````
`Functions
````````````````````````````````````````````````````````````````````````````
Function POLAR_CAMERA(center_x#,center_y#,center_z#,horizontal_angle#,vertical_angle#,distance#)
rem Perform polar calculations using sin and cosine
new_x# = center_x# + distance#*cos(vertical_angle#)*sin(horizontal_angle#)
new_y# = center_y# + distance#*sin(vertical_angle#)
new_z# = center_z# + distance#*cos(vertical_angle#)*cos(horizontal_angle#)
rem Position camera at the new coordinates
position camera new_x#,new_y#,new_z#
endfunction
Function POLAR_OBJECT(object#,center_x#,center_y#,center_z#,horizontal_angle#,vertical_angle#,distance#)
rem Perform polar calculations using sin and cosine
new_x# = center_x# + distance#*cos(vertical_angle#)*sin(horizontal_angle#)
new_y# = center_y# + distance#*sin(vertical_angle#)
new_z# = center_z# + distance#*cos(vertical_angle#)*cos(horizontal_angle#)
rem Position camera at the new coordinates
position object object#,new_x#,new_y#,new_z#
endfunction
For those of you with DarkMATTER...I used the Android.x models...The texture is the android texture which can be found in the 3ds/ section of the DarkMATTER Folder, the reson I textured it with its original texture because I colorized Player Two's Texture Red...In the code I know I could of used arrays for a few more things but in this case I didn't feel comfortable doing so...the Music is the Battle.mid that coems with DB Full and the Areana Texture is the one included in DM in the textures/bmp/sci-fi called wall_m_44.bmp, I really hope you enjoy this game and it inspires you to be a better proggramer!
1. I included the Polar_Object Function because I was playing with it to see if it would do any good...
2. any other resources I forgot to mention?
3. This is my first game ever (of course I made other sims but they wern't games)... what should I do next?