parententity + positionentity O_o

Blitz3D Forums/Blitz3D Beginners Area/parententity + positionentity O_o

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Doesn't work...

Graphics3D 800,600,32,2
SetBuffer BackBuffer()

Global cam = CreateCamera()
PositionEntity cam,0,0,0

Global lux = CreateLight()
PositionEntity lux,0,10,0

Global cube = CreateCube()
PositionEntity cube,0,0,10

Type mov
 Field obj
 Field x#
 Field y#
 Field z#
End Type
Global xinc#=-1.3
Global yinc#= 1
Global direction#=.1
Global newdirection#

For a = 0 To 19
 mov1.mov = New mov
  mov1\obj = CreateCube()
  EntityColor mov1\obj,120,120,120
  ScaleEntity mov1\obj,.1,.1,.1
  If xinc > 2 Then yinc = yinc - 1 : xinc = -1.3
  mov1\y = yinc
  mov1\x = 0.1 + xinc
  xinc = xinc + 1.0
  mov1\z = -3
  EntityParent mov1\obj,cube
  PositionEntity mov1\obj,mov1\x,mov1\y,mov1\z
Next

While Not KeyDown(1)

If KeyDown(203) Then TurnEntity cube,0,-1,0
If KeyDown(205) Then TurnEntity cube,0,1,0
If KeyDown(200) Then MoveEntity cam,0,0,.1
If KeyDown(208) Then MoveEntity cam,0,0,-.1
MoveEntity cam,0,0,0
TurnEntity cube,0,0,0

newdirection = direction
For mov1.mov = Each mov
 PositionEntity mov1\obj,mov1\x,mov1\y,mov1\z
 If mov1\x > 1.9 Then newdirection = -0.1
 If mov1\x < -1.9 Then newdirection =0.1
 mov1\x = mov1\x + newdirection
Next
direction = newdirection

RenderWorld()
UpdateWorld()
Flip
Wend