CodeWalrus

Development => Calculators => Calc Projects, Programming & Tutorials => Topic started by: Unicorn on September 01, 2016, 10:13:59 PM

Title: DoodleJump CE [C] [TI 84+ CE]
Post by: Unicorn on September 01, 2016, 10:13:59 PM
So I am attempting to create a doodle jump clone for the CE. I've gotten as far as a menu screen with a whole bunch of sprites, and I need to get double buffers working so I can erase graphics, and I've worked for a while trying to make it run fast, but to no avail. So, I'm wondering if anyone would like to try themselves to make this buffering work at an acceptable speed. Here's how fast I've gotten it (a video):

https://usercontent.irccloud-cdn.com/file/LoWwP3Fk/DoubleBuffering%2Cmp4.mp4

So there's that, and here is the code if you want to take a shot at making it work at a reasonable speed.


//--------------------------------------
// Program Name:
// Author:
// License:
// Description:
//--------------------------------------

/* Keep these headers */
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <tice.h>

/* Standard headers - it's recommended to leave them included */
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <graphx.h>
#include <keypadc.h>
#include <fileioc.h>
#include <debug.h>
#include "gfx/sprites.h"
/* Other available headers */
// stdarg.h, setjmp.h, assert.h, ctype.h, float.h, iso646.h, limits.h, errno.h, debug.h

/* Put your function prototypes here */
void spriteDecompress();
void drawMenu();
/* Put all your globals here. */
gfx_image_t *splashScreen;
gfx_image_t *dLeft;
gfx_image_t *dLeftBG;
gfx_image_t *greenPlatform;
gfx_image_t *brokePlatform;
gfx_image_t *spring;
gfx_image_t *grid;
void main(void) {
uint8_t x = 130, key = 0, keypress = 0, guyY = 168;
bool guyUp = true;
gfx_Begin(gfx_8bpp);
gfx_FillScreen(gfx_white);
gfx_SetPalette( sprites_pal, sizeof(sprites_pal), 0);
spriteDecompress();
gfx_SetDrawBuffer();
drawMenu();
gfx_SetDrawScreen();
drawMenu();
gfx_TransparentSprite(greenPlatform, 130, 190);
while (kb_ScanGroup(kb_group_6) != kb_Clear) {
if (key & kb_Left) {
x -= 109;
guyY = 168;
gfx_TransparentSprite(greenPlatform, x, 190);
}
if (key & kb_Right) {
x += 109;
guyY = 168;
gfx_TransparentSprite(greenPlatform, x, 190);
}
gfx_SetDrawBuffer();
drawMenu();
gfx_TransparentSprite(greenPlatform, x, 190);
gfx_PrintStringXY("Start", 145, 197);
gfx_PrintStringXY("Settings", 30, 197);
gfx_PrintStringXY("Quit", 262, 197);
gfx_TransparentSprite_NoClip(dLeft, x+18, guyY);
gfx_SwapDraw();
gfx_SetDrawScreen();
if (guyUp == true)
guyY-=5;
if (guyUp == false)
guyY+=7;
if (guyY <= 80)
guyUp = false;
if (guyY >= 168)
guyUp = true;
key = kb_ScanGroup(kb_group_7);
keypress++;
}
gfx_End();
pgrm_CleanUp();
}
void drawMenu(void) {
uint8_t y = 0;
uint24_t x = 0;
gfx_FillScreen(214);
gfx_SetColor(213);
for (x = 0; x<320; x+=16) {
gfx_Line(x, 0, x, 240);
}
for (y = 0; y<240; y+=16) {
gfx_Line(0, y, 320, y);
}

gfx_ScaledTransparentSprite_NoClip(splashScreen, 60, 0, 2, 2);
gfx_SetTextFGColor(8);
gfx_PrintStringXY("Start", 145, 197);
gfx_PrintStringXY("Settings", 30, 197);
gfx_PrintStringXY("Quit", 262, 197);
}
void spriteDecompress(void) {
malloc(0);
splashScreen = gfx_AllocSprite(100, 47, malloc);
dLeft = gfx_AllocSprite(25, 25, malloc);
brokePlatform = gfx_AllocSprite(72, 19, malloc);
greenPlatform = gfx_AllocSprite(75, 22, malloc);
spring = gfx_AllocSprite(34, 17, malloc);
grid = gfx_AllocSprite(16, 16, malloc);
gfx_LZDecompressSprite(splashScreen_data_compressed, splashScreen);
gfx_LZDecompressSprite(brokePlatform_data_compressed, brokePlatform);
gfx_LZDecompressSprite(greenPlatform_data_compressed, greenPlatform);
gfx_LZDecompressSprite(spring_data_compressed, spring);
gfx_LZDecompressSprite(grid_data_compressed, grid);
gfx_LZDecompressSprite(dLeft_data_compressed, dLeft);
}
/* Put other functions here */


Help would be greatly appreciated :)
Title: Re: DoodleJump CE
Post by: Dream of Omnimaga on September 03, 2016, 04:01:53 AM
I thought I had replied to this topic, but I guess I didn't. I saw the screenshots before and the one you just posted on IRC and I like what I see so far. Maybe you could have multiple characters like in AssemblyBandit's CSE jumper game, including a :walrii: .

Also you should put the GIFs in the first post, because not everyone can or want to open MP4 files (in my case this particular file won't play).
Title: Re: DoodleJump CE
Post by: Unicorn on September 03, 2016, 04:09:22 AM
Quote from: DJ Omnimaga on September 03, 2016, 04:01:53 AM
I thought I had replied to this topic, but I guess I didn't. I saw the screenshots before and the one you just posted on IRC and I like what I see so far. Maybe you could have multiple characters like in AssemblyBandit's CSE jumper game, including a :walrii: .

Also you should put the GIFs in the first post, because not everyone can or want to open MP4 files (in my case this particular file won't play).
Haha, yeah, I'm going to put a gif now, that was just for testing purposes.

Anyways, I have physics working, thanks to the Flappy Bird author including his source! anyways, an image:

(https://usercontent.irccloud-cdn.com/file/4qkH8QIN/DoodleJ%20v0.2.gif)
Title: Re: DoodleJump CE
Post by: Dream of Omnimaga on September 03, 2016, 05:37:03 AM
What I like in particular is the hand drawn style overall. If the text was hand drawn too, then I would have suggested drawing it multiple times and animating each frame, like in Yoshi's Island for the Super Nintendo. That would have been kinda cool. :D
Title: Re: DoodleJump CE
Post by: JWinslow23 on September 03, 2016, 03:03:26 PM
Quote from: Unicorn on September 03, 2016, 04:09:22 AM
Quote from: DJ Omnimaga on September 03, 2016, 04:01:53 AM
I thought I had replied to this topic, but I guess I didn't. I saw the screenshots before and the one you just posted on IRC and I like what I see so far. Maybe you could have multiple characters like in AssemblyBandit's CSE jumper game, including a :walrii: .

Also you should put the GIFs in the first post, because not everyone can or want to open MP4 files (in my case this particular file won't play).
Haha, yeah, I'm going to put a gif now, that was just for testing purposes.

Anyways, I have physics working, thanks to the Flappy Bird author including his source! anyways, an image:

(https://usercontent.irccloud-cdn.com/file/4qkH8QIN/DoodleJ%20v0.2.gif)
Having made a Flappy Bird clone before, yet knowing a +C clone of Flappy Bird exists, I'm wondering exactly which Flappy Bird :P .

That looks awesome, by the way! It'll probably be more awesome than Jumper when it's done!
Title: Re: DoodleJump CE [C] [TI 84+ CE]
Post by: c4ooo on September 03, 2016, 03:06:25 PM
Nice! For a second I thought the game was running at 1 frame per second but then I realized the gif was just loading slowly.
Title: Re: DoodleJump CE
Post by: Dream of Omnimaga on September 03, 2016, 06:02:29 PM
Quote from: JWinslow23 on September 03, 2016, 03:03:26 PM
Quote from: Unicorn on September 03, 2016, 04:09:22 AM
Quote from: DJ Omnimaga on September 03, 2016, 04:01:53 AM
I thought I had replied to this topic, but I guess I didn't. I saw the screenshots before and the one you just posted on IRC and I like what I see so far. Maybe you could have multiple characters like in AssemblyBandit's CSE jumper game, including a :walrii: .

Also you should put the GIFs in the first post, because not everyone can or want to open MP4 files (in my case this particular file won't play).
Haha, yeah, I'm going to put a gif now, that was just for testing purposes.

Anyways, I have physics working, thanks to the Flappy Bird author including his source! anyways, an image:

(https://usercontent.irccloud-cdn.com/file/4qkH8QIN/DoodleJ%20v0.2.gif)
Having made a Flappy Bird clone before, yet knowing a +C clone of Flappy Bird exists, I'm wondering exactly which Flappy Bird :P .

That looks awesome, by the way! It'll probably be more awesome than Jumper when it's done!
I think he's refering to the CE Flappy Bird on Cemetech.
Title: Re: DoodleJump CE
Post by: Unicorn on September 04, 2016, 12:59:07 AM
Quote from: c4ooo on September 03, 2016, 03:06:25 PM
Nice! For a second I thought the game was running at 1 frame per second but then I realized the gif was just loading slowly.
Thanks! And yeah, the gif does run a bit slow when loading the page.

Quote from: DJ Omnimaga on September 03, 2016, 06:02:29 PM
Quote from: JWinslow23 on September 03, 2016, 03:03:26 PM
Quote from: Unicorn on September 03, 2016, 04:09:22 AM
Quote from: DJ Omnimaga on September 03, 2016, 04:01:53 AM
I thought I had replied to this topic, but I guess I didn't. I saw the screenshots before and the one you just posted on IRC and I like what I see so far. Maybe you could have multiple characters like in AssemblyBandit's CSE jumper game, including a :walrii: .

Also you should put the GIFs in the first post, because not everyone can or want to open MP4 files (in my case this particular file won't play).
Haha, yeah, I'm going to put a gif now, that was just for testing purposes.

Anyways, I have physics working, thanks to the Flappy Bird author including his source! anyways, an image:

(https://usercontent.irccloud-cdn.com/file/4qkH8QIN/DoodleJ%20v0.2.gif)
Having made a Flappy Bird clone before, yet knowing a +C clone of Flappy Bird exists, I'm wondering exactly which Flappy Bird :P .

That looks awesome, by the way! It'll probably be more awesome than Jumper when it's done!
I think he's refering to the CE Flappy Bird on Cemetech.
Haha, that is correct! I haven't made any progress today. but I may yet...
Title: Re: DoodleJump CE
Post by: Unicorn on September 22, 2016, 09:12:38 PM
bump. I haven't really made any progress, BUT, I am working on creating some sort of custom levels using tilemaps. So when I'm done with implementing those, I'll have some screenshots.

Right now there seems to be some weird problems with the tilemaps, mateo is helping/doing it for me fix them.
Title: Re: DoodleJump CE
Post by: kotu on September 22, 2016, 09:16:14 PM
Quote from: Unicorn on September 22, 2016, 09:12:38 PM
Right now there seems to be some weird problems with the tilemaps, mateo is helping/doing it for me fix them.

what are the problems?
Title: Re: DoodleJump CE [C] [TI 84+ CE]
Post by: p2 on September 23, 2016, 01:36:44 AM
The AutoIt-version of doodle jump I mentioned on IRC sadly got deleted and the website hoster went ofline... (the hoster itself) so I guess all the great tiles used in that version of the game are gone, sorry :/
(Will have to do it yourself afterall) ^^
Title: Re: DoodleJump CE
Post by: Dream of Omnimaga on September 27, 2016, 06:29:41 AM
I'm glad this is still alive. Good luck resolving the issues you have.
Quote from: p2 on September 23, 2016, 01:36:44 AM
The AutoIt-version of doodle jump I mentioned on IRC sadly got deleted and the website hoster went ofline... (the hoster itself) so I guess all the great tiles used in that version of the game are gone, sorry :/
(Will have to do it yourself afterall) ^^
Can't the owner be contacted?
Title: Re: DoodleJump CE
Post by: Unicorn on September 27, 2016, 07:08:09 AM
Quote from: kotu on September 22, 2016, 09:16:14 PM
Quote from: Unicorn on September 22, 2016, 09:12:38 PM
Right now there seems to be some weird problems with the tilemaps, mateo is helping/doing it for me fix them.

what are the problems?
I fixed them up, but I've decided to let tilemaps be implemented another day :P (I don't need them, I was experimenting)

Quote from: p2 on September 23, 2016, 01:36:44 AM
The AutoIt-version of doodle jump I mentioned on IRC sadly got deleted and the website hoster went ofline... (the hoster itself) so I guess all the great tiles used in that version of the game are gone, sorry :/
(Will have to do it yourself afterall) ^^
Did you see my screenshot? Those tiles work, don't they?
Title: Re: DoodleJump CE [C] [TI 84+ CE]
Post by: p2 on September 27, 2016, 08:41:38 AM
yess, never said they wouldnt ^^ But the autoIt version also had all tiles for jungle, space, ice, ... themes which might  be useful to you :) (If you intend to add them, too) :)
Quote from: DJ Omnimaga on September 27, 2016, 06:29:41 AM
Quote from: p2 on September 23, 2016, 01:36:44 AM
The AutoIt-version of doodle jump I mentioned on IRC sadly got deleted and the website hoster went ofline... (the hoster itself) so I guess all the great tiles used in that version of the game are gone, sorry :/
(Will have to do it yourself afterall) ^^
Can't the owner be contacted?
I'm not sure since the project is already a few youars old and the links still weren't fixed... idk if the owner is still interested in this project...
This was the old forum post (on german): https://autoit.de/index.php/Thread/18368-Doodle-Jump-f%C3%BCr-Pc/
BUT I managed to find an old upload...  :w00t:
@Unicorn: You should take a look at it ;) https://mega.nz/#!PJcn2SBa!v33KRytsHswuXoKk9C6pufDKht4rZTGXPBDTwiVqrhw
It's got all the original tiles and sounds in it :)
Title: Re: DoodleJump CE
Post by: Dream of Omnimaga on October 05, 2016, 04:29:10 PM
Nice. By the way to save space you could always use color palette changes so you can re-use the graphics you have but with different colors for more themes.
Title: Re: DoodleJump CE
Post by: Unicorn on October 05, 2016, 06:36:02 PM
Quote from: DJ Omnimaga on October 05, 2016, 04:29:10 PM
Nice. By the way to save space you could always use color palette changes so you can re-use the graphics you have but with different colors for more themes.
Yeah, maybe, but that would be more things to learn :P I'm gonna go ahead and get everything working before I end up adding themes and things.

EDIT: Also, things are A-Jumping

(https://usercontent.irccloud-cdn.com/file/oVLqLTmz/DoodleJ%20v0.4.gif)

(Tho it needs some tweaking)
Title: Re: DoodleJump CE [C] [TI 84+ CE]
Post by: p2 on October 06, 2016, 07:36:19 AM
it seems to be a bit buggy looks like it's got something to do with scrolling... ^^
But I still really like it, good job!  :thumbsup:
Will you mirror the doodle to make it look in different directions? :)
Title: Re: DoodleJump CE
Post by: Dream of Omnimaga on October 06, 2016, 07:13:13 PM
I like the result so far, although it seems like the collision detection gets out of sync with the scrolling. Hopefully that gets fixed when you implement auto-scrolling.
Title: Re: DoodleJump CE [C] [TI 84+ CE]
Post by: Dudeman313 on October 14, 2016, 01:15:54 AM
The graphics are sooo close to the original! Nice work so far! :thumbsup:
Title: Re: DoodleJump CE
Post by: Unicorn on October 16, 2016, 06:20:33 AM
Quote from: p2 on October 06, 2016, 07:36:19 AM
it seems to be a bit buggy looks like it's got something to do with scrolling... ^^
But I still really like it, good job!  :thumbsup:
Will you mirror the doodle to make it look in different directions? :)

Thanks! Yup, I will get to mirroring, eventually.

Quote from: DJ Omnimaga on October 06, 2016, 07:13:13 PM
I like the result so far, although it seems like the collision detection gets out of sync with the scrolling. Hopefully that gets fixed when you implement auto-scrolling.
Thanks as well! I have to figure out collision detection more before I implement auto-scrolling, and that is being really annoying. I'll try to work on it this week.
Title: Re: DoodleJump CE
Post by: MateoConLechuga on October 16, 2016, 06:45:43 AM
Quote from: Unicorn on October 16, 2016, 06:20:33 AM
Quote from: DJ Omnimaga on October 06, 2016, 07:13:13 PM
I like the result so far, although it seems like the collision detection gets out of sync with the scrolling. Hopefully that gets fixed when you implement auto-scrolling.
Thanks as well! I have to figure out collision detection more before I implement auto-scrolling, and that is being really annoying. I'll try to work on it this week.
Might I recommend the hundreds of C platform tutorials on the googles rather than trying to figure it out on your own? :) Just a suggestion.