I'm making a game in ICE and wanted to know:
How can I convert a small picture to a sprite?
How do you save a sprite to an appvar?
How can I flip a sprite?
How can I press multiple buttons at once?

Thanks! Smile
Justin wrote:
I'm making a game in ICE and wanted to know:
How can I convert a small picture to a sprite?
How do you save a sprite to an appvar?
How can I flip a sprite?
How can I press multiple buttons at once?

Thanks! Smile


1. Use ConvPNG by Mateo, which can be downloaded here: https://github.com/MateoConLechuga/ConvPNG/releases

2. Assuming you already defined the sprite with DefineSprite, all you have to do is this:

Code:
CloseAll()
Open("APPVAR","w+")->A
Write(SPRITEPTR,SIZE,1,A)

Where SPRITEPTR is the pointer you got from DefineSprite(, "APPVAR" is the name of the appvar you would like to create, and SIZE is the size of your sprite (L*W+2 bytes).
Then to read the sprite from the appvar:

Code:
CloseAll()
Open("APPVAR","r")->A
GetDataPTR(A)->SPRITE

You can then display the sprite by doing:

Code:
Sprite(SPRITE,X,Y)

as you usually would.

3. Pretty easy, just use the FlipSpriteX and FlipSpriteY commands. Note that you will have to allocate data fields for the flipped sprites using DefineSprite( (Just define an empty sprite, then store the pointer to it). PTRIN should be the sprite you would like to convert, and PTROUT should be the pointer to one of your empty sprites. You can then display the flipped sprite by doing:

Code:
Sprite(PTROUT,X,Y)


4. Very easy, since ICE lets you read the current status of any key at any time, all you have to do is this:

Code:
If getKey(GETKEYA) and getKey(GETKEYB)
Conditional code here
End


I hope this helps. Let me know if you have any more questions.
Thank you! Smile
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement