AutoCenterSpriteHandle
AutoCenterSpriteHandle SpriteIndex, Flag
 
Parameters:

    SpriteIndex = The index of the sprite you wish to change auto center state of
    Flag = 0 = Auto Sprite Center Is (OFF), 1 = Auto Center is (ON)
Returns: NONE
 

     AutoCenterSpriteHandle tells PlayBASIC to automatically center this sprites handle (it's rotation axis) every time the image property of this sprite is changed. In other words,the sprite will automatically center it's handles for you, every time you change the sprites image.




FACTS:


      * Centers a sprites image handles around the current (and future) assigned images.

      * See GetAutoCenterSpriteHandle to retrieve this properties state.

      * Also, see CenterSpriteHandle & SpriteHandle





Mini Tutorial:


      This example Creates a sprite, assign it an image, centers the sprites handles on this image, then displays these values back.

  
; Create Image  #10 of size 100x by 200y in pixels
  CreateImage 10,100,200
  
; Create Sprite #1
  CreateSprite 1
  
; Set this sprite to AUTO CENTER any future assigned images.
  AutoCenterSpriteHandle 1,true
  
; Assign our created image to this sprite..
  SpriteImage 1,10
  
  
; Display this sprites newly set sprite handle offsets
  
  Print GetAutoCenterSpriteHandle(1)
  Print GetSpriteHandleX(1)
  Print GetSpriteHandleY(1)
  
; Display the Screen and wait for the user to press a key
  Sync
  WaitKey
  



This example would output.

  
  1
  -50
  -100
  

 
Related Info: CenterSpriteHandle | GetAutoCenterSpriteHandle | GetSpriteHandleX | GetSpriteHandleY | SpriteHandle | SpriteImage :
 


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