Problem with types....

Blitz3D Forums/Blitz3D Programming/Problem with types....

elseano(Posted 2003) [#1]
I thought i had them all figured out...
But, it seems my code still won't work and it keeps on coming up with the error message "type name not found" :(
Could someone please help me with this?
Here's the code, by the way:




;;;;;;;;;;;;;;;;;;;;;;

Graphics3D 640,480

SetBuffer BackBuffer()

AmbientLight 170,170,170

;;;;;;;;;;;;;;;;;;;;;;

spark=CreateSphere(10)
EntityAlpha spark,0.7
EntityColor spark,255,100,20


Type bullet

Field bulx
Field buly
Field bulz
Field alpha
Field entity

End Type

;;;;;;;;;;;;;;;;;;;;;;

grasstex=LoadTexture( "C:/3dgame/grasstex.bmp" )
playertex=LoadTexture( "C:/3dgame/playertex.bmp" )
plane=LoadTerrain( "C:/3dgame/hieghtmap.bmp" )
PositionEntity plane,0,-100,0
player=LoadMesh( "C:/3dgame/player.3ds" )
RotateEntity player,0,0,0
Global piv=CreatePivot(player)
EntityColor player,140,200,150
EntityTexture plane,grasstex
EntityTexture player,playertex
ScaleEntity player,0.2,0.2,0.2
MoveEntity piv,0,-5,0




Global cam=CreateCamera()

me=1
walls=2
EntityType player,me

Type wall
Field entity
End Type

Collisions me,walls,3,1



;;;;;;;;;;;;;;;;;;;;;

While Not KeyHit(1)

If KeyDown (203) Then TurnEntity player,0,0.75,0
If KeyDown(205) Then TurnEntity player,0,-0.75,0
If KeyDown(200) Then playerspeed=playerspeed+0.1
If KeyDown(208) Then playerspeed=playerspeed-0.1
If KeyDown(30) Then MoveEntity player,0,0.5,0 MoveEntity cam,0,0.5,0
If KeyDown(44) Then MoveEntity player,0,-0.5,0 MoveEntity cam,0,-0.5,0

If playerspeed>3 Then playerspeed=3
If playerspeed<1 Then playerspeed=1


If KeyDown(45) Then

shot.bullet = New bullet
shot\bulx = playerx
shot\buly = playery
shot\bulz = playerz
shot\alpha = 1
shot\entity = CopyEntity(spark)

updatebullet

EndIf

MoveEntity player,0,0,playerspeed

smoothcam(piv,player,50)

RenderWorld
UpdateWorld

Flip

Wend

End

;;;;;;;;;;;;;;;;;;;;;;

Function smoothcam(pivot,target,camspeed)


curx#=EntityX(cam)
curz#=EntityZ(cam)
destx#=EntityX(pivot,True)
destz#=EntityZ(pivot,True)

curx#=curx#+((destx#-curx#)/camspeed)
curz#=curz#+((destz#-curz#)/camspeed)
cury#=0.75

PositionEntity cam,curx#,cury#,curz#

PointEntity cam,target
End Function


;;;;;;;;;;;;;;;;;;;;;;

Function updatebullet()

For shot.bullet=Each spark
EntityAlpha shot\entity,shot\alpha
shot\alpha=shot\alpha-0.02
If shot\alpha<=0 Then FreeEntity shot\entity : Delete shot
Next

End Function

;;;;;;;;;;;;;;;;;;;;;;


Rogue Vector(Posted 2003) [#2]
In the function updatebullet()

Change the first line to:

For shot.bullet=Each bullet

Hope this helps

RV


elseano(Posted 2003) [#3]
Thank you very much.