Main forum > GLBasic - en

Multiple Objects

(1/1)

Guest:
The following example from the samples is modified to move the object along the X-axis with a call to X_MOVEMENT.  What happens if you load two objects and wish to place them at different locations?  Can X_MOVEMENT be applied to a specific object?

//Anim Example
X_LOADOBJ  "moon.ddd", 1
LOADSPRITE "moon.bmp", 1

WHILE TRUE
   X_MAKE3D 1, 1200, 60
   X_CAMERA 0, 0, 100, 0, 0, 0
   X_SPOT_LT 0, RGB(255,255,255), 0,50,100,0,10,100,180

   phi=phi+GETTIMER()/10
   permil=permil+GETTIMER()/20000;
   IF permil>=1 THEN permil=0
   
   X_MOVEMENT 30, 0, 0
   
   X_ROTATION 270, 1,0,0
   X_ROTATION phi, 0,-1,0

   X_SETTEXTURE 1, -1
   X_DRAWANIM 1, 0, 128, permil, TRUE
   SHOWSCREEN
WEND
//End

Kitty Hello:

--- Quote from: UserN ---//Anim Example
X_LOADOBJ  "moon.ddd", 1
LOADSPRITE "moon.bmp", 1

X_LOADOBJ  "sun.ddd", 2
LOADSPRITE "sun.bmp", 2
WHILE TRUE
   X_MAKE3D 1, 1200, 60
   X_CAMERA 0, 0, 100, 0, 0, 0
   X_SPOT_LT 0, RGB(255,255,255), 0,50,100,0,10,100,180

   phi=phi+GETTIMER()/10
   permil=permil+GETTIMER()/20000;
   IF permil>=1 THEN permil=0
   
   X_MOVEMENT 30, 0, 0
   
   X_ROTATION 270, 1,0,0
   X_ROTATION phi, 0,-1,0

   X_SETTEXTURE 1, -1
   X_DRAWANIM 1, 0, 128, permil, TRUE


--- End quote ---
   // Draw Object #2...
   X_MOVEMENT 80, 0, 0 // This will reset X_ROTATIONs
   X_SETTEXTURE 2, -1   // Set Texture for object #2
   X_DRAWANIM 2, 0, 128, permil, TRUE // Render Object #2

--- Quote from: UserN ---   SHOWSCREEN
WEND

--- End quote ---

Guest:
Thanks.  Makes sense...I should have been able to solve the problem on my own.

Navigation

[0] Message Index

Go to full version