MoveSprite
MoveSprite SpriteIndex, Xdist#, Ydist#
 
Parameters:

    SpriteIndex = The identifier of the sprite you wish to create
    Xdist# = The value to add to the Sprites X positon
    Ydist# = The value to add to the Sprites Y positon
Returns: NONE
 

      MoveSprite changes the sprite current position by applying a change in to both the X and Y coordinates of sprites current position.


      It's the same as the following manual calculation.

  
  newx#=GetSpriteX(SpriteIndex)+Xdist#
  newy#=GetSpriteY(SpriteIndex)+Ydist#
  PositionSprite SpriteIndex,newx#,newy#
  




FACTS:


      * MoveSprite does not effect the Z position of this sprite. If you wish to the change the depth, then use MoveSpriteZ.

      * MoveSprite can support sliding collision with the appropriate sprite collision mode See: SpriteCollisionMode




Mini Tutorial:


      Create a sprite, set it's position, move it and display its new position to the screen.

  
  
  
; Create the Sprite
  CreateSprite 1
  
; Set this sprites entities X and Y Positions to 100x,200y
  PositionSprite 1100,200
  
; Add 10x,20y to this sprites X/Y Position.
  MoveSprite 110,20
  
; Read and display sprite 1's position X,Y and Z position to the screen.
  Print GetSpriteX(1)
  Print GetSpriteY(1)
  Print GetSpriteZ(1)
  
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  



This example would output.

  
  110.0
  220.0
  0.0
  

 
Related Info: PositionSprite | PositionSpriteX | PositionSpriteXYZ | PositionSpriteY | PositionSpriteZ :
 


(c) Copyright 2002 - 2024 - Kevin Picone - PlayBASIC.com