ive made a Type called Zombie, and used it to initialize some zombies on the screen:
.places
Data 15,15,80,16,15,57,0,15,70,5,15,80,15,15,70
Restore places
For j = 1 To 5
p.zombie = New zombie
Read k
p\x = k
Read k
p\y = k
Read k
p\z = k
p\t = ENEMY
p\n = LoadAnimMesh("zombie\zombie.b3d")
ScaleEntity p\n,0.1,0.1,0.1
PositionEntity p\n,p\x,p\y,p\z
ExtractAnimSeq p\n,22,36
Animate p\n, 1,0.1,1
EntityRadius p\n,0.1
EntityType p\n,p\t
p\s = IDLE
p\h = 100
Next
then i use the type in a function:
Function CheckGravity()
If Not EntityCollided(p\n,SCENERY)
TranslateEntity p\n,0,-0.1,0
End If
End Function
and i call the function from my main loop like this:
For p.zombie = Each zombie
checkgravity()
checkai()
Next
when i run the program, it gives me the error: "Variable must be a Type", and points to the line:
If Not EntityCollided(p\n,SCENERY)
since that's the first line that calls the type, im assuming that it's the type that has the problem, but really not sure...
.places
Data 15,15,80,16,15,57,0,15,70,5,15,80,15,15,70
Restore places
For j = 1 To 5
p.zombie = New zombie
Read k
p\x = k
Read k
p\y = k
Read k
p\z = k
p\t = ENEMY
p\n = LoadAnimMesh("zombie\zombie.b3d")
ScaleEntity p\n,0.1,0.1,0.1
PositionEntity p\n,p\x,p\y,p\z
ExtractAnimSeq p\n,22,36
Animate p\n, 1,0.1,1
EntityRadius p\n,0.1
EntityType p\n,p\t
p\s = IDLE
p\h = 100
Next
then i use the type in a function:
Function CheckGravity()
If Not EntityCollided(p\n,SCENERY)
TranslateEntity p\n,0,-0.1,0
End If
End Function
and i call the function from my main loop like this:
For p.zombie = Each zombie
checkgravity()
checkai()
Next
when i run the program, it gives me the error: "Variable must be a Type", and points to the line:
If Not EntityCollided(p\n,SCENERY)
since that's the first line that calls the type, im assuming that it's the type that has the problem, but really not sure...