SPRITE FLIP

Post Reply
davey110
Posts: 102
Joined: Mon Dec 26, 2016 11:01 pm
My devices: iPhone SE 2020
iPad mini 2
Flag: Canada

SPRITE FLIP

Post by davey110 »

I find that SPRITE N$ FLIP K does not work. I had to make a new sprite.

User avatar
Dutchman
Posts: 877
Joined: Mon May 06, 2013 9:21 am
My devices: iMac, iPad Air, iPhone
Location: Netherlands
Flag: Netherlands

Re: SPRITE FLIP

Post by Dutchman »

I tested the sample program from the PDF manual on page 54:

Code: Select all

'Example of repeated FLIP usage:
  Sprite$="submarine 1.png"
  sh=SCREEN_HEIGHT()
  sw=SCREEN_WIDTH()
  movex=3
  GRAPHICS
  OPTION SPRITE POS CENTRAL
  SPRITE "a" LOAD Sprite$
  SPRITE "a" DELAY 0.04
  SPRITE "a" AT sw/2,sh/2
  SPRITE "a" dX movex
  SPRITE "a" SHOW
  SPRITE "a" loop

  DO
  PAUSE 1
  CALL ReverseSprite
  GET TOUCH nn AS x,y
  UNTIL x>-1
  SPRITES DELETE
  TEXT
  END
DEF ReverseSprite ' Function to alternate flip
  Flipped=(Flipped+1)%2
  SPRITE "a" FLIP Flipped
  SPRITE "a" dX .movex*(1-Flipped*2)
END DEF
The program uses following image:
submarine 1.png
submarine 1.png (10.15 KiB) Viewed 182 times
The submarine flips as expected.
Probably the sprite needs to be be generated from an image file.

Post Reply