Just for fun
Community Forums/Showcase/Just for fun| 
 | ||
| Well i took a small break from programming my mud and made the following with my almost step-son, it was just for fun! Its 3d and needs no external files note- space bar fires, keypad 4 left, 6 right,8 forward, 2 back/slow 
Graphics3D 800,600,16,1
SetBuffer BackBuffer()
Type_player=1
Type_ship=2
type_plane=3
type_bullet=4
type_explosion=5
plife=100
charge=LoadImage("c:\charge.bmp")
image=LoadImage("c:\menu.bmp")
DrawImage image,0,0
Flip
WaitKey()
miss=CreateSphere()
HideEntity miss
player=CreateCone()
PositionEntity player,50,5,5
nplayer=CreateCube()
ScaleEntity nplayer,3.5,.1,.2
RotateEntity nplayer,90,0,0
PositionEntity nplayer,50,.5,4.75
EntityParent nplayer,player
gameover=LoadImage("c:\hitimage.bmp")
terrain=CreatePlane()
tex1=LoadTexture("c:\image1.bmp")
EntityTexture terrain,tex1
ScaleEntity terrain,10,10,1
RotateEntity player,90,0,0
cam=CreateCamera()
CameraRange cam,.1,200
PositionEntity cam,50,8,-3
light=CreateLight()
RotateEntity light,90,0,0
EntityParent cam,player
ship=CreateCube()
ScaleEntity ship,5,5,5
shiptex=LoadTexture("c:\ship.bmp")
;EntityTexture ship,shiptex
HideEntity ship
plane=CreateCube()
planetex=LoadTexture("c:\plane.bmp")
HideEntity plane
shz=20
For x=1 To 50
y=1
shx=0
While y<100
p.newship=New newship
p\shipe=CopyEntity(ship)
p\shipclass=Type_ship
EntityType p\shipe,type_ship
EntityTexture p\shipe,shiptex
PositionEntity p\shipe,shx,7,shz
EntityRadius p\shipe,5.5
shx=shx+50
y=y+1
Wend
shz=shz+50
Next
RenderWorld
Flip
Type newship
Field shipe
Field shipclass
End Type
prot=0
cube=CreateSphere()
;TurnEntity cube,90,0,0
tex3=LoadTexture("c:\green.bmp")
EntityTexture cube,tex3
HideEntity cube
sphere=CreateSphere()
;ScaleEntity sphere,5,5,5
tex=LoadTexture("c:\red.bmp")
EntityTexture sphere,tex
HideEntity sphere
speed#=0
EntityType player,type_player
While Not KeyHit(1)
FlushKeys()
ddl=0
x=0
If KeyHit(75)=True Then
TurnEntity player,0,0,5
prot=prot+5
EndIf
If KeyHit(77)=True Then
TurnEntity player,0,0,-5
prot=prot-5
EndIf
;If KeyHit(208)=True MoveEntity player,0,-1,0
;If KeyHit(200)=True MoveEntity player,0,1,0
If KeyHit(80)=True Then
speed#=speed#+.1
x=1
EndIf
If KeyHit(72)=True 
speed#=speed#-.1
x=2
EndIf
If KeyDown(75)=True Then
TurnEntity player,0,0,5
prot=prot+5
EndIf
If KeyDown(77)=True Then 
TurnEntity player,0,0,-5
prot=prot-5 
EndIf
If KeyDown(72)=True Then
speed#=speed#+.1
x=1
EndIf
If KeyDown(80)=True Then
speed#=speed#-.5
x=2
EndIf
;If KeyDown(208)=True MoveEntity player,0,-1,0
;If KeyDown(200)=True MoveEntity player,0,1,0
If x=0 Then speed#=speed#-.05
If x<>2 Then
If speed#<0 speed#=0
EndIf
If speed#>5 Then speed#=5
MoveEntity player,0,speed,0
If prot>360 prot=prot-360
If prot<0 prot=prot+360
px=EntityX(player)
py=EntityY(player)
pz=EntityZ(player)
bdelay=bdelay-1
If bdelay<1 Then
If KeyDown(57)=True Then
b.bullet=New bullet
b\bentity=CopyEntity(cube)
EntityType b\bentity,Type_bullet
EntityRadius b\bentity,1
b\bx=EntityX(player)
b\by=EntityY(player)
b\bz=EntityZ(player)
b\rot=prot
b\duration=15
b\duration2=10
b\dur=1
PositionEntity b\bentity,b\bx,b\by,b\bz
TurnEntity b\bentity,0,b\rot,0
MoveEntity b\bentity,0,0,5
bdelay=5
EndIf
EndIf
For b.bullet=Each bullet
If b\dur=1 Then
b\duration=b\duration-1
MoveEntity b\bentity,0,0,10
EndIf
If b\duration<1 Then
b\duration=100
b\dur=3
b\dur3=5
bx=EntityX(b\bentity)
by=EntityY(b\bentity)
bz=EntityZ(b\bentity)
FreeEntity b\bentity
b\bentity=CopyEntity(miss)
PositionEntity b\bentity,bx,by,bz
EntityTexture b\bentity,tex
;TurnEntity b\bentity,b\rot,0,0
;b\escale=2
UpdateNormals b\bentity
EndIf
If b\dur=2 Then
TurnEntity b\bentity,15,-5,-5
b\escale=b\escale+2
ScaleEntity b\bentity,b\escale,b\escale,b\escale
b\duration2=b\duration2-1
EndIf
If b\duration<1 Then
FreeEntity b\bentity
Delete b
EndIf
If b\dur=3 Then
b\dur3=b\dur3-1
If b\dur3<1 Then
FreeEntity b\bentity
Delete b
EndIf
EndIf
Next
Collisions type_bullet,type_ship,1,1
Collisions type_player,type_ship,1,1
xc#=CountCollisions(player)
For a=1 To xc#
hit=CollisionEntity(player,1)
a=GetEntityType(hit) 
If a=2 Then 
plife=plife-1
z=1:d=1
Color 255,255,255
For a=1 To 3 Step 1
;z=z+1
;If z>5 Then 
;If d=1 EntityTexture hit,charge
;If d=2 EntityTexture hit,shiptex
;z=1
;EndIf
;UpdateNormals hit
;RenderWorld
Text 100,100,"STEER CAREFFULLY THESE HURT!"
Flip
Next
EndIf
Next
If plife<1 Then
RenderWorld
Cls
DrawImage gameover,0,0
Flip
Delay 1500
ClearWorld()
End
EndIf
For b.bullet=Each bullet
a=0
t=0
a=CountCollisions (b\bentity)
If a=1 Then
hitx=CollisionEntity(b\bentity,1)
t=GetEntityType(hitx)
b\duration=100
b\duration2=3
b\dur=2
bx=EntityX(b\bentity)
by=EntityY(b\bentity)
bz=EntityZ(b\bentity)
FreeEntity b\bentity
b\bentity=CopyEntity(sphere)
PositionEntity b\bentity,bx,by,bz
TurnEntity b\bentity,b\rot,0,0
EntityType b\bentity,Type_explosion
b\escale=2
EndIf
If t=2 Then
HideEntity hitx
FreeEntity hitx
EndIf
If b\duration2<1 Then
FreeEntity b\bentity 
Delete b
EndIf
Next
UpdateWorld
RenderWorld
Text 10,10,"Coordinates:  "+px+","+py+","+pz
Text 10,20,"Rotation:  "+prot
Text 10,30,"Coll:  "+xc
Text 10,40, "Life="+plife
Flip
Delay 10
Wend
ClearWorld()
End
Type bullet
Field bx
Field by
Field bz
Field rot
Field duration
Field bentity
Field duration2
Field dur
Field dur3
Field escale
End Type
 | 
| 
 | ||
|  Its 3d and needs no external files   If so, what are the LoadImage statements for ? charge=LoadImage("c:\charge.bmp") image=LoadImage("c:\menu.bmp") gameover=LoadImage("c:\hitimage.bmp") tex1=LoadTexture("c:\image1.bmp") tex=LoadTexture("c:\red.bmp") LOL ! | 
| 
 | ||
| Also noticed that :D | 
| 
 | ||
| oops, doh! forgot about that, sorry! hehehe |