Music is what makes your game appealing to people.
Music is what makes the game warmer, and allows you to connect emotionally with your audience.
simple sound loading for background sounds:
music= LoadSound("gone.mp3")
LoopSound music
PlaySound music
LISTER CODE SETUP (for 3d sound) :
music= Load3DSound("gone.mp3")
LoopSound music
ghostspeaker = CreateListener(man,0.2,0.1)
EmitSound(music,enemy1)
please make sure that the objects used for the listener and the emit sound object already exist before you try to use them.
Thursday, February 28, 2008
Thursday, February 7, 2008
Health Bar Code
This code includes simple code for making a health bar in blitz:
Graphics3D 800,600, 16,1
Global health = 100000
light = CreateLight()
Const player=1
Const scene=2
Collisions player,scene, 2,2
man = CreateCylinder()
EntityColor man, 99,99,99
EntityType man, player
Global manpivot = CreateSphere(8,man)
MoveEntity manpivot,0,0,10
ScaleEntity manpivot,0.1,0.1,0.1
Global wall = CreateCube()
ScaleEntity wall, 5,1,1
HideEntity wall
enemy1= CreateCone()
EntityColor enemy1, 255,200,50
EntityType enemy1,player
enemy2 = CreateCone()
EntityColor enemy2, Rand(255),Rand(255),Rand(255)
EntityType enemy2, player
SeedRnd (enemy2)
Global camera= CreateCamera(man)
MoveEntity camera, 0,10,-20
plane = CreatePlane()
EntityColor plane, 0,255,0
MoveEntity plane,0,-10,0
For i = 1 To 100
box = CreateCube()
ScaleEntity box, 5,2,5
PositionEntity box, Rand(1000), 0, Rand(1000)
EntityColor box, Rand(255),Rand(255), Rand(255)
EntityType box, scene
Next
While Not KeyHit(1)
PointEntity camera,man
If KeyDown(200) Then MoveEntity man, 0,0,2
If KeyDown(208) Then MoveEntity man, 0,0,-2
If KeyDown(203) Then TurnEntity man,0,1,0
If KeyDown(205) Then TurnEntity man, 0,-1,0
;If KeyDown(15) Then MoveEntity man, 0,1,0
PointEntity enemy1, man
PointEntity enemy2, man
MoveEntity enemy1, 0,0,0.3
MoveEntity enemy2, 0,0,0.5
If EntityDistance (enemy1, man) < 5 Then health = health -1
If EntityDistance (enemy2, man) < 5 Then health = health -3
If health = 0 Then End
;; CREATING WALLS ON THE FLY
If KeyHit (2) Then
newwall = CopyEntity (wall)
xx# = EntityX(manpivot,True)
yy# = EntityY(manpivot)
zz# = EntityZ(manpivot,True)
PositionEntity newwall, xx,yy,zz,True
EntityType newwall, scene
RotateEntity newwall, 0,EntityYaw(man),0
End If
UpdateWorld
RenderWorld
Text 20,20, health
If health > 97000 Then
Color 0,200,45
Rect 40,40,health/125-40, 10
Else
Color 200,0,0
Rect 40,40,health/125-40, 10
End If
Flip
Wend
Graphics3D 800,600, 16,1
Global health = 100000
light = CreateLight()
Const player=1
Const scene=2
Collisions player,scene, 2,2
man = CreateCylinder()
EntityColor man, 99,99,99
EntityType man, player
Global manpivot = CreateSphere(8,man)
MoveEntity manpivot,0,0,10
ScaleEntity manpivot,0.1,0.1,0.1
Global wall = CreateCube()
ScaleEntity wall, 5,1,1
HideEntity wall
enemy1= CreateCone()
EntityColor enemy1, 255,200,50
EntityType enemy1,player
enemy2 = CreateCone()
EntityColor enemy2, Rand(255),Rand(255),Rand(255)
EntityType enemy2, player
SeedRnd (enemy2)
Global camera= CreateCamera(man)
MoveEntity camera, 0,10,-20
plane = CreatePlane()
EntityColor plane, 0,255,0
MoveEntity plane,0,-10,0
For i = 1 To 100
box = CreateCube()
ScaleEntity box, 5,2,5
PositionEntity box, Rand(1000), 0, Rand(1000)
EntityColor box, Rand(255),Rand(255), Rand(255)
EntityType box, scene
Next
While Not KeyHit(1)
PointEntity camera,man
If KeyDown(200) Then MoveEntity man, 0,0,2
If KeyDown(208) Then MoveEntity man, 0,0,-2
If KeyDown(203) Then TurnEntity man,0,1,0
If KeyDown(205) Then TurnEntity man, 0,-1,0
;If KeyDown(15) Then MoveEntity man, 0,1,0
PointEntity enemy1, man
PointEntity enemy2, man
MoveEntity enemy1, 0,0,0.3
MoveEntity enemy2, 0,0,0.5
If EntityDistance (enemy1, man) < 5 Then health = health -1
If EntityDistance (enemy2, man) < 5 Then health = health -3
If health = 0 Then End
;; CREATING WALLS ON THE FLY
If KeyHit (2) Then
newwall = CopyEntity (wall)
xx# = EntityX(manpivot,True)
yy# = EntityY(manpivot)
zz# = EntityZ(manpivot,True)
PositionEntity newwall, xx,yy,zz,True
EntityType newwall, scene
RotateEntity newwall, 0,EntityYaw(man),0
End If
UpdateWorld
RenderWorld
Text 20,20, health
If health > 97000 Then
Color 0,200,45
Rect 40,40,health/125-40, 10
Else
Color 200,0,0
Rect 40,40,health/125-40, 10
End If
Flip
Wend
Creating Walls on the fly
The core code for this is located at
http://www.awosa.net/code for now.
This code is for the Blitz3D engine.
This code we altered in class today to include the ability to create walls on the fly:
---------------------------------------------------------------------------------
Graphics3D 800,600, 16,1
Global health = 100000
light = CreateLight()
Const player=1
Const scene=2
Collisions player,scene, 2,2
man = CreateCylinder()
EntityColor man, 99,99,99
EntityType man, player
Global manpivot = CreateSphere(8,man)
MoveEntity manpivot,0,0,10
ScaleEntity manpivot,0.1,0.1,0.1
Global wall = CreateCube()
ScaleEntity wall, 5,1,1
HideEntity wall
enemy1= CreateCone()
EntityColor enemy1, 255,200,50
EntityType enemy1,player
enemy2 = CreateCone()
EntityColor enemy2, Rand(255),Rand(255),Rand(255)
EntityType enemy2, player
SeedRnd (enemy2)
Global camera= CreateCamera(man)
MoveEntity camera, 0,10,-20
plane = CreatePlane()
EntityColor plane, 0,255,0
MoveEntity plane,0,-10,0
For i = 1 To 100
box = CreateCube()
ScaleEntity box, 5,2,5
PositionEntity box, Rand(1000), 0, Rand(1000)
EntityColor box, Rand(255),Rand(255), Rand(255)
EntityType box, scene
Next
While Not KeyHit(1)
PointEntity camera,man
If KeyDown(200) Then MoveEntity man, 0,0,2
If KeyDown(208) Then MoveEntity man, 0,0,-2
If KeyDown(203) Then TurnEntity man,0,1,0
If KeyDown(205) Then TurnEntity man, 0,-1,0
;If KeyDown(15) Then MoveEntity man, 0,1,0
PointEntity enemy1, man
PointEntity enemy2, man
MoveEntity enemy1, 0,0,0.3
MoveEntity enemy2, 0,0,0.5
If EntityDistance (enemy1, man) < 5 Then health = health -1
If EntityDistance (enemy2, man) < 5 Then health = health -3
If health = 0 Then End
;; CREATING WALLS ON THE FLY
If KeyHit (2) Then
newwall = CopyEntity (wall)
xx# = EntityX(manpivot,True)
yy# = EntityY(manpivot)
zz# = EntityZ(manpivot,True)
PositionEntity newwall, xx,yy,zz,True
EntityType newwall, scene
RotateEntity newwall, 0,EntityYaw(man),0
End If
UpdateWorld
RenderWorld
Text 20,20, health
Flip
Wend
http://www.awosa.net/code for now.
This code is for the Blitz3D engine.
This code we altered in class today to include the ability to create walls on the fly:
---------------------------------------------------------------------------------
Graphics3D 800,600, 16,1
Global health = 100000
light = CreateLight()
Const player=1
Const scene=2
Collisions player,scene, 2,2
man = CreateCylinder()
EntityColor man, 99,99,99
EntityType man, player
Global manpivot = CreateSphere(8,man)
MoveEntity manpivot,0,0,10
ScaleEntity manpivot,0.1,0.1,0.1
Global wall = CreateCube()
ScaleEntity wall, 5,1,1
HideEntity wall
enemy1= CreateCone()
EntityColor enemy1, 255,200,50
EntityType enemy1,player
enemy2 = CreateCone()
EntityColor enemy2, Rand(255),Rand(255),Rand(255)
EntityType enemy2, player
SeedRnd (enemy2)
Global camera= CreateCamera(man)
MoveEntity camera, 0,10,-20
plane = CreatePlane()
EntityColor plane, 0,255,0
MoveEntity plane,0,-10,0
For i = 1 To 100
box = CreateCube()
ScaleEntity box, 5,2,5
PositionEntity box, Rand(1000), 0, Rand(1000)
EntityColor box, Rand(255),Rand(255), Rand(255)
EntityType box, scene
Next
While Not KeyHit(1)
PointEntity camera,man
If KeyDown(200) Then MoveEntity man, 0,0,2
If KeyDown(208) Then MoveEntity man, 0,0,-2
If KeyDown(203) Then TurnEntity man,0,1,0
If KeyDown(205) Then TurnEntity man, 0,-1,0
;If KeyDown(15) Then MoveEntity man, 0,1,0
PointEntity enemy1, man
PointEntity enemy2, man
MoveEntity enemy1, 0,0,0.3
MoveEntity enemy2, 0,0,0.5
If EntityDistance (enemy1, man) < 5 Then health = health -1
If EntityDistance (enemy2, man) < 5 Then health = health -3
If health = 0 Then End
;; CREATING WALLS ON THE FLY
If KeyHit (2) Then
newwall = CopyEntity (wall)
xx# = EntityX(manpivot,True)
yy# = EntityY(manpivot)
zz# = EntityZ(manpivot,True)
PositionEntity newwall, xx,yy,zz,True
EntityType newwall, scene
RotateEntity newwall, 0,EntityYaw(man),0
End If
UpdateWorld
RenderWorld
Text 20,20, health
Flip
Wend
Subscribe to:
Comments (Atom)