here is my code
Graphics3D 600,400,32,2
SeedRnd(MilliSecs())
units=1
floors=2
Type beast
Field entity
End Type
player=CreatePivot()
camera=CreateCamera(player)
PositionEntity camera,0,3,0
EntityType player,units
Global beast=CreateCube()
PositionEntity beast,0,5,0
EntityColor beast,255,0,0
EntityType beast,units
HideEntity beast
ground=CreatePlane()
PositionEntity ground,0,-3,0
EntityType ground,floors
Collisions units,units,2,3
Collisions units,floors,2,3
While Not KeyHit(1)
If KeyHit(2) Then
s.beast=New beast
s\entity=CopyEntity(beast)
PositionEntity beast,Rnd(-20,20),5,Rnd(-20,20)
EndIf
For s.beast=Each beast
If EntityDistance(s\entity,player)<45 Then
PointEntity s\entity,player
MoveEntity s\entity,0,0,.3
EndIf
Next
this is what is wrong
For s.beast=Each beast
gravity(s/entity,1)
Next
it says arithmetic operatior cannot be applied to custom type objects
gravity(player,1)
;keymovement
If KeyDown(17) Then MoveEntity player,0,0,.5
If KeyDown(31) Then MoveEntity player,0,0,-.5
If KeyDown(30) Then MoveEntity player,-.5,0,0
If KeyDown(32) Then MoveEntity player,.5,0,0
;Mouse movement
Local x_speed#,y_speed#
x_speed=(MouseXSpeed()-x_speed)/2+x_speed
y_speed=(MouseYSpeed()-y_speed)/2+y_speed
MoveMouse 320,240
TurnEntity player,0,-x_speed,0
TurnEntity camera,-y_speed,0,0
UpdateWorld
RenderWorld
Flip
Wend
End
Function gravity(unit$,speed#)
TranslateEntity Unit$,0,-speed#,0
End Function
Graphics3D 600,400,32,2
SeedRnd(MilliSecs())
units=1
floors=2
Type beast
Field entity
End Type
player=CreatePivot()
camera=CreateCamera(player)
PositionEntity camera,0,3,0
EntityType player,units
Global beast=CreateCube()
PositionEntity beast,0,5,0
EntityColor beast,255,0,0
EntityType beast,units
HideEntity beast
ground=CreatePlane()
PositionEntity ground,0,-3,0
EntityType ground,floors
Collisions units,units,2,3
Collisions units,floors,2,3
While Not KeyHit(1)
If KeyHit(2) Then
s.beast=New beast
s\entity=CopyEntity(beast)
PositionEntity beast,Rnd(-20,20),5,Rnd(-20,20)
EndIf
For s.beast=Each beast
If EntityDistance(s\entity,player)<45 Then
PointEntity s\entity,player
MoveEntity s\entity,0,0,.3
EndIf
Next
this is what is wrong
For s.beast=Each beast
gravity(s/entity,1)
Next
it says arithmetic operatior cannot be applied to custom type objects
gravity(player,1)
;keymovement
If KeyDown(17) Then MoveEntity player,0,0,.5
If KeyDown(31) Then MoveEntity player,0,0,-.5
If KeyDown(30) Then MoveEntity player,-.5,0,0
If KeyDown(32) Then MoveEntity player,.5,0,0
;Mouse movement
Local x_speed#,y_speed#
x_speed=(MouseXSpeed()-x_speed)/2+x_speed
y_speed=(MouseYSpeed()-y_speed)/2+y_speed
MoveMouse 320,240
TurnEntity player,0,-x_speed,0
TurnEntity camera,-y_speed,0,0
UpdateWorld
RenderWorld
Flip
Wend
End
Function gravity(unit$,speed#)
TranslateEntity Unit$,0,-speed#,0
End Function