Ok thanks again Unicorn.

It is now time to implement sprites I think.
I have looked at the sprite routine in the graphics .h file but can someone explain the "data" bit of it? That would be awesome and I could have this mostly done by the end of the day today Smile
Sprite data is an array of bytes containing palette indices.

[edit]

see, for example, https://github.com/CE-Programming/libraries/blob/master/graphics/graphics_demos/demo_0/main.c
So to convert sprite, open a command window where your images are located. (in PNG format)

Then type this code:


Code:
convpng -8hjz -i myimage.png -p mypalette.png

Since you have multiple sprite, the mypalette.png file will include the palette used across all sprites.

myimage.png will contain one of your sprites, and then you can just repeat the above command for however many sprites you have. Then you can move the output files around a bit to make proper header files with just a single palette array and arrays of sprites.

Then what you need to do is tell the LCD to use the palette that your sprites use. This can be accomplished simply by using this code after gc_InitGraph():


Code:
gc_SetPalette(mypalette_pal, sizeof(mypalette_pal));


Then you can just use this code to draw your sprites:


Code:
gc_NoClipDrawSprite(mysprite, 0, 0, widthofsprite, heightofsprite);


Where widthofsprite and heightofsprite are of the images you converted.
I can't use a command window because this is a school computer. Is there another way? can source coder do it with the nspire c section of image conversion or is that different?
So, here's a quick solution: Copy this code directly after all of your #include directives. Then you should be able to use them since multiple files seem to be confused at the moment.


Code:
uint16_t boxman_pal[9] = {
    0x7EB9,    /* 0x00 */
    0x4FF3,    /* 0x01 */
    0x01DF,    /* 0x02 */
    0x267F,    /* 0x03 */
    0x0340,    /* 0x04 */
    0x03E0,    /* 0x05 */
    0x0156,    /* 0x06 */
    0x7FFF,    /* 0x07 */
    0x0000     /* 0x08 */
};

uint8_t player_left_sprite[160] = {
    0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,
    0x00,0x00,0x04,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x01,0x00,0x00,
    0x00,0x00,0x04,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x01,0x00,0x00,
    0x00,0x00,0x04,0x05,0x07,0x07,0x07,0x05,0x05,0x07,0x07,0x07,0x05,0x01,0x00,0x00,
    0x00,0x00,0x04,0x05,0x08,0x08,0x07,0x05,0x05,0x08,0x08,0x07,0x05,0x01,0x00,0x00,
    0x00,0x00,0x04,0x05,0x08,0x08,0x07,0x05,0x05,0x08,0x08,0x07,0x05,0x01,0x00,0x00,
    0x00,0x00,0x04,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x08,0x05,0x01,0x00,0x00,
    0x00,0x00,0x04,0x05,0x05,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x05,0x01,0x00,0x00,
    0x00,0x00,0x04,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x01,0x00,0x00,
    0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x05,0x00,0x00
};

uint8_t player_right_sprite[160] = {
    0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00,0x00,
    0x00,0x00,0x04,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x01,0x00,0x00,
    0x00,0x00,0x04,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x01,0x00,0x00,
    0x00,0x00,0x04,0x05,0x07,0x07,0x07,0x05,0x05,0x07,0x07,0x07,0x05,0x01,0x00,0x00,
    0x00,0x00,0x04,0x05,0x07,0x08,0x08,0x05,0x05,0x07,0x08,0x08,0x05,0x01,0x00,0x00,
    0x00,0x00,0x04,0x05,0x07,0x08,0x08,0x05,0x05,0x07,0x08,0x08,0x05,0x01,0x00,0x00,
    0x00,0x00,0x04,0x05,0x08,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x01,0x00,0x00,
    0x00,0x00,0x04,0x05,0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x05,0x05,0x01,0x00,0x00,
    0x00,0x00,0x04,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x05,0x01,0x00,0x00,
    0x00,0x00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x05,0x00,0x00
};

uint8_t box_sprite[256] = {
    0x02,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
    0x06,0x02,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,
    0x06,0x06,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x03,0x03,
    0x06,0x06,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x03,0x03,
    0x06,0x06,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x03,0x03,
    0x06,0x06,0x02,0x02,0x02,0x02,0x06,0x06,0x06,0x06,0x06,0x02,0x02,0x02,0x03,0x03,
    0x06,0x06,0x02,0x02,0x02,0x03,0x02,0x02,0x02,0x02,0x06,0x02,0x02,0x02,0x03,0x03,
    0x06,0x06,0x02,0x02,0x02,0x03,0x02,0x02,0x02,0x02,0x06,0x02,0x02,0x02,0x03,0x03,
    0x06,0x06,0x02,0x02,0x02,0x03,0x02,0x02,0x02,0x02,0x06,0x02,0x02,0x02,0x03,0x03,
    0x06,0x06,0x02,0x02,0x02,0x03,0x02,0x02,0x02,0x02,0x06,0x02,0x02,0x02,0x03,0x03,
    0x06,0x06,0x02,0x02,0x02,0x03,0x03,0x03,0x03,0x03,0x02,0x02,0x02,0x02,0x03,0x03,
    0x06,0x06,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x03,0x03,
    0x06,0x06,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x03,0x03,
    0x06,0x06,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0x03,0x03,
    0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x02,0x03,
    0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x06,0x02
};
Here's a "Mateo Style Video Screenshot" as I dubbed it yesterday in IRC.
I'm taking suggestions for the title screen. It's pretty boring right now.

How about a random arrangement of boxes on the bottom of the screen? Or using the boxes to make borders around the blocks of text?

Botboy3000 wrote:
I can't use a command window because this is a school computer. Is there another way? can source coder do it with the nspire c section of image conversion or is that different?
SourceCoder will shortly be able to convert PNG images as part of projects; sorry I haven't had the time to do that already. Also, if you have any feedback or comments on using SourceCoder for C programming, I'd greatly appreciate them in the topic. Smile
Ooooo! I like the first idea! Maybe a random arrangement of blocks that don't exceed one block differences of column heights and then have the Boxman randomwalking across it?

EDIT:: I think if there is ever time in your schedule you could try to implement something like Mateo's ConvPNG or PNGconv or whatever it was called that would convert the png into a ez80 C format. It would be very helpful seeing the increase of C popularity.
Will there by a background(ex. blue sky, sun)? How about making other blocks(ex. different colors, design)? If you want, I can design some extra stuff for you.
I think it's time for beta-testing and bug-fixing suggestions Razz

post if you want to beta test please and be prepared to help fix bugs you find Smile
I'll pm you a link to download. Thanks to all in advance!

EDIT:: once this program is done and in the archives I may also begin porting my terrible PCSE moon bubble game but make it more like the original. Look for that in another topic Smile
I want to beta test! Very Happy
And you're welcome! Wink
And when you get to the Moon Bubble game, I'll be happy to test that too!
Razz
I wanna beta test too Laughing
I'll be the first to report a bug!
When I played the game the first time, the title screen came up.
I hit [2nd] and was greeted with a terrifyingly slow game where the boxes take forever to fall and the character moves slowly.
The score and level counter was also screwed up; the level counter had strange characters and the score went up 1 for every 2 boxes on the screen. Instead of restarting the program, I let the little green critter die, and then restarted.
This fixed everything, and the game ran smoothly like the video.

When the game is finished, will there be a scoreboard, or just a top score on the title screen with/without a name?
Could the game over message be on a panel like object centered in the middle of the screen (similar to Tetrica)? I think that would make it look nicer Very Happy
Dudeman313 wrote:
I'll be the first to report a bug!
When I played the game the first time, the title screen came up.
I hit [2nd] and was greeted with a terrifyingly slow game where the boxes take forever to fall and the character moves slowly.
The score and level counter was also screwed up; the level counter had strange characters and the score went up 1 for every 2 boxes on the screen. Instead of restarting the program, I let the little green critter die, and then restarted.
This fixed everything, and the game ran smoothly like the video.

When the game is finished, will there be a scoreboard, or just a top score on the title screen with/without a name?


Hmmm.. I think I know why the level didn't work at first and I think I have a way to fix that.
I do like the idea of labeling the score with maybe.. idk, "Score: " Razz I'll add that.

KingInfinity wrote:
Could the game over message be on a panel like object centered in the middle of the screen (similar to Tetrica)? I think that would make it look nicer Very Happy


That is entirely possible and I do like the sound of it. I suppose during testing I just needed a way to make sure that the game over was happening but never went back and changed it. Great ideas! I hope to get more of them Smile

I sadly, however cannot test this program anymore without CEmu because my CE no longer connects with any computer as documented in my "triple blink issue" thread. So I can't send the rom to my computer and can't use CEmu Sad I'll just have to wait till TI replies to my email regarding compensation. Razz
Oh, and I also realized that the boxes flicker while falling.

As for your CE issue, maybe you should just run to Walmart, cut open a CE that you can return, and try its cable. if it's just your cable, return the CE and buy a new cable from eBay. Of course, that'd require you to have your own spendable money....
So, I think I have a new version ready for beta testing. I have:

-- Fixed level number glitch when you start the game which also fixes slow first level
-- Added score and level labeling
-- Fixed box flickering
-- Tested winning and initiating new level
-- Fixed not being able to go to the left-most column

So, post again if you want to continue beta testing or begin. I'll pm you with the link to download the .8xp file. Thanks in advance Very Happy
Botboy3000 wrote:
So, I think I have a new version ready for beta testing. I have:

-- Fixed level number glitch when you start the game which also fixes slow first level
-- Added score and level labeling
-- Fixed box flickering
-- Tested winning and initiating new level
-- Fixed not being able to go to the left-most column

So, post again if you want to continue beta testing or begin. I'll pm you with the link to download the .8xp file. Thanks in advance Very Happy

"Again." Razz
You're welcome! Very Happy


EDIT:
I found a bug.
When I ran this the first time, the char. sprite did not appear until I moved. This was a one-time thing.
And the boxes still "ripple" but it's hardly noticeable. What the boxes do do that's annoying is erase the score/level writing if when they fall.

Other than that, it's fun, but I can't get past level one! Razz
This game looks pretty fun, mind if I port it to PICO-8?

EDIT: welp, done: http://www.lexaloffle.com/bbs/?tid=3207
I have gotten more than 10 colors in the color palette. Is this the correct notation for when these are used in sprite?
  
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 2 of 4
» 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