Page 1 of 1

CopySprite question

Posted: Mon Mar 02, 2015 4:03 pm
by ricardo
Im just playing for the first time with SpiderBasic. Im using the sprite example and i want to copy a sprite when a key is released.

I add this:

Code: Select all

    If KeyboardReleased(#PB_Key_O)
      CopySprite(0,2)
;       DisplaySprite(2,100,100)
    EndIf
And nothing happends. The sprite 0 exists, remember i am using the sprite example. Also i tried to move the DisplaySprite near to the other DisplaySprite and nothing.

Can someone show me some example please?

Best Regards

Re: CopySprite question

Posted: Tue Mar 10, 2015 8:52 am
by SinisterSoft
In your code you have commented out the line to display the sprite - that maybe why it isn't displayed.

Re: CopySprite question

Posted: Tue Mar 10, 2015 6:42 pm
by Arbrakaan

Code: Select all

Procedure RenderFrame()
  Static x, y, x2, y2, Paused, previousElapsed
  
  ClearScreen(RGB(0, 0, 0))

  If ExamineKeyboard()
    
    If KeyboardReleased(#PB_Key_Up)
      Debug "Ok"
      res = CopySprite(0,2)  
      DisplaySprite(2,50,50)
      Debug "Ok II"
    EndIf
    
    
    DisplaySprite(0, x, y)
    DisplaySprite(1, x*4+100, y*4)
  EndIf
  
  FlipBuffers() ; continue the rendering
EndProcedure
I have the same problem

when res = CopySprite(0,2) is in comment, i get the "OK II" else, nothing happen.