Thanks big, I didn't know there are updates for the docs too.
OK, I'm still going nuts with the enemies. I managed to get the "enemy" cube to follow me like this:
But that's just a test I am doing. In reality, I need this code to work for 200 enemy entities. Here's the code for that:
"malomeshes" is an array containing my 200 enemy entities. The "active" array tells which enemies become active as they enter the player's view. The code is basically the same save for the number of entities and the names of the entities, so why won't it work with the 200 enemies? Any hints for that?
This seems too difficult. Maybe I'm better off using pure trigonometry to do the enemy rotation.
OK, I'm still going nuts with the enemies. I managed to get the "enemy" cube to follow me like this:
While Not KeyDown(1) If KeyDown(200) ;up MoveEntity cube2,0,0,1 End If If KeyDown(208) ;down MoveEntity cube2,0,0,-1 End If If KeyDown(203) ;left MoveEntity cube2,-1,0,0 End If If KeyDown(205) ;right MoveEntity cube2,1,0,0 End If AlignToVector cube,EntityX(cube2),EntityY(cube2),EntityZ(cube2),1,0.05 AlignToVector cube,EntityX(cube2),EntityY(cube2),EntityZ(cube2),3,0.05 ;AlignToVector cube,EntityX(cube2),EntityY(cube2),EntityZ(cube2),2,0.01 If EntityX(cube) > EntityX(cube2) Then MoveEntity cube,-0.5,0,0 If EntityZ(cube) > EntityZ(cube2) Then MoveEntity cube,0,0,-0.5 If EntityX(cube) < EntityX(cube2) Then MoveEntity cube,0.5,0,0 If EntityZ(cube) < EntityZ(cube2) Then MoveEntity cube,0,0,0.5 UpdateWorld RenderWorld Text 0,0,Str(EntityPitch(cube)) Text 0,20,Str(EntityYaw(cube)) Text 0,40,Str(EntityRoll(cube)) If EntityCollided(cube2,1) Then Text 0,60,"Ouch!" If EntityCollided(cube,2) Then Text 0,60,"Ouch!" Flip
But that's just a test I am doing. In reality, I need this code to work for 200 enemy entities. Here's the code for that:
For x = 0 To 199 If EntityInView(malomeshes(x),camera) Then active(x) = 1 End If Next ;movimiento de los malos For x = 0 To 199 If active(x)=1 AlignToVector malomeshes(x),EntityX(player),0,EntityZ(player),1,0.05 AlignToVector malomeshes(x),EntityX(player),EntityY(player),EntityZ(player),3,0.05 If EntityX(malomeshes(x)) > EntityX(player) Then MoveEntity malomeshes(x),-0.5,0,0 If EntityZ(malomeshes(x)) > EntityZ(player) Then MoveEntity malomeshes(x),0,0,-0.5 If EntityX(malomeshes(x)) < EntityX(player) Then MoveEntity malomeshes(x),0.5,0,0 If EntityZ(malomeshes(x)) < EntityZ(player) Then MoveEntity malomeshes(x),0,0,0.5 End If Next
"malomeshes" is an array containing my 200 enemy entities. The "active" array tells which enemies become active as they enter the player's view. The code is basically the same save for the number of entities and the names of the entities, so why won't it work with the 200 enemies? Any hints for that?
This seems too difficult. Maybe I'm better off using pure trigonometry to do the enemy rotation.