Author Topic: Multiple Objects  (Read 3994 times)

Guest

  • Guest
Multiple Objects
« on: 2004-Apr-24 »
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

Offline Kitty Hello

  • code monkey
  • Administrator
  • Prof. Inline
  • *******
  • Posts: 10723
  • here on my island the sea says 'hello'
    • View Profile
    • http://www.glbasic.com
Multiple Objects
« Reply #1 on: 2004-Apr-26 »
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

   // 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

Guest

  • Guest
Multiple Objects
« Reply #2 on: 2004-Apr-27 »
Thanks.  Makes sense...I should have been able to solve the problem on my own.