CopySprite question

Just starting out? Need help? Post your questions and find answers here.
ricardo
Posts: 3
Joined: Mon Mar 02, 2015 3:58 pm

CopySprite question

Post 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
User avatar
SinisterSoft
Posts: 77
Joined: Sun Apr 06, 2014 11:41 pm
Location: Preston, UK
Contact:

Re: CopySprite question

Post by SinisterSoft »

In your code you have commented out the line to display the sprite - that maybe why it isn't displayed.
User avatar
Arbrakaan
Posts: 91
Joined: Mon Feb 24, 2014 10:54 pm
Location: Geneva
Contact:

Re: CopySprite question

Post 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.
Post Reply