Alternatively, join us on Discord.

+-Recent Topics

[TI-84+CE] This Is The Only Level +CE

Started by JWinslow23, September 11, 2016, 10:13:25 pm

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

JWinslow23

September 11, 2016, 10:13:25 pm Last Edit: December 19, 2016, 08:13:22 pm by JWinslow23
This Is The Only Level now has its own port to the TI-84+CE!



Beat the level. There's only one.

Download here on ticalc.org!

[spoiler=Original post]I've decided to take up C for the CE (thank you, Mateo :) ). My first game will be This Is The Only Level. You know, like this one.

I've gotten done with the tilemapper. Here's a gif of the current progress:



Download is attached.

There are a couple of questions I want answered, though, so the development process can go as quickly as possible.

1. What's "sprite clipping" and should I use it?
2. For some odd reason, the gfx_TransparentSprite() routine leaves the tile sprites normal when drawn slightly off-screen, but the player sprite entirely disappears when he is off-screen even one pixel. Why is that, and how do I fix it?
3. The "random" colors for the background and spikes look like different shades of blue for some reason. Am I doing it wrong, or is there bias in the random numbers?
4. Are there any more conventions and things that can make my programming life easier?[/spoiler]

MateoConLechuga

Just in case :)
Quote from: MateoConLechugaNice work! Looking pretty spiffy; I'd be happy to give coding suggestions on how to speed things up.

Quote from: JWinslow231. What's "sprite clipping" and should I use it?
2. For some odd reason, the gfx_TransparentSprite() routine leaves the tile sprites normal when drawn slightly off-screen, but the player sprite entirely disappears when he is off-screen even one pixel. Why is that, and how do I fix it?
3. The "random" colors for the background and spikes look like different shades of blue for some reason. Am I doing it wrong, or is there bias in the random numbers?
4. Are there any more conventions and things that can make my programming life easier?

1. Sprite clipping makes sure the sprite is drawn properly if parts of it are drawn offscreen or partially offscreen. Sprite functions have a _NoClip version which are a lot faster if the sprites you intend to use won't be offscreen ever.
2. It's probably because you are sending incorrect types (signed vs unsigned) values to the function as arguments. Take another look; the function works as intended :)
3. You basically have to design the palette yourself and the random colors that should be selected. You can set up the palette with random rgb values by looping and doing something like gfx_palette = rgbTo1555( r, g, b );
4. I don't believe there are any platformer games yet; but anything you learn or discover along the way would be neat :)

DJ Omnimaga

Glad to see a color version @JWinslow23 :D . I am definitively looking forward for it. How fast does it run so far?

JWinslow23

September 12, 2016, 03:38:01 am #3 Last Edit: September 12, 2016, 04:04:54 am by JWinslow23
Quote from: DJ Omnimaga on September 12, 2016, 02:52:37 am
Glad to see a color version @JWinslow23 :D . I am definitively looking forward for it. How fast does it run so far?

Exactly as fast as it does in the screenshot. I'm literally clearing the screen and re-drawing the tilemap every frame, because I can't see any solution so far for erasing the elephant. Without this redrawing, however, it runs at way over playable speed, so if I find some way to only redraw the parts I need, it'll be fine.

By the way, can anyone help me with that? The code is up there. I have ideas, but they have all either not worked or caused flickering.

EDIT: Current code here. Minus a proper "random color" system, all changes are internal, so my job is easier. I did the same thing in the TITOL 84+ program, so I'm thinking it could help here.

DJ Omnimaga

Weird, when I checked the topic earlier at work and just an hour or so ago the screenshot was not animated at all. It is now. Hence why I was asking the speed. As for erasing the elephant, if flickering is the issue, couldn't you use 8-bits mode, draw the map twice on two sides of the screen and flip between each side while erasing the elephant on the invisible side? That's what most people do.

JWinslow23

Quote from: DJ Omnimaga on September 12, 2016, 05:38:05 am
Weird, when I checked the topic earlier at work and just an hour or so ago the screenshot was not animated at all. It is now. Hence why I was asking the speed. As for erasing the elephant, if flickering is the issue, couldn't you use 8-bits mode, draw the map twice on two sides of the screen and flip between each side while erasing the elephant on the invisible side? That's what most people do.

That's what's happening, with a buffer the same size as the full screen. The trouble is erasing the elephant in the first place without redrawing everything. I don't know how to erase him.

DJ Omnimaga


MateoConLechuga

So I'm really sorry, but I got a little carried away with looking at your code... but anyhow, the basic idea is to save the background behind the transparent sprite, and then when you move the sprite, restore what was behind it previously. Rather than using gfx_SwapDraw(), you can use gfx_Blit( gfx_buffer ); in order to copy the back buffer to the screen. Here's the result that I got from it:



Also, I just made the double buffering thing work; didn't change too much else except for moving globals to local functions and such. If you do plan to use globals, try to keep them contained inside of a C structure :)

Edited source code is below.

JWinslow23

Thank you so much, I would never have figured that out myself. :)

Another question: How do I activate using the OS fonts (graphscreen and homescreen) and drawing them onto the screen? I tried gfx_SetMonospaceFont(0), but it's not working.

MateoConLechuga

Using the following functions:

gfx_SetTextFGColor();
gfx_SetTextBGColor();
gfx_SetTextFGColor();
gfx_PrintStringXY();
gfx_SetTextScale();
gfx_PrintString();
gfx_PrintInt();
gfx_PrintUInt();
gfx_SetTextXY();


JWinslow23

September 12, 2016, 08:46:49 am #10 Last Edit: September 12, 2016, 12:37:45 pm by JWinslow23
Quote from: MateoConLechuga on September 12, 2016, 08:41:57 am
Using the following functions:

gfx_SetTextFGColor();
gfx_SetTextBGColor();
gfx_SetTextFGColor();
gfx_PrintStringXY();
gfx_SetTextScale();
gfx_PrintString();
gfx_PrintInt();
gfx_PrintUInt();
gfx_SetTextXY();


I think you misunderstand. I was just using PrintStringXY, but it prints the C monospace font. I want the OS homescreen and graphscreen fonts. I'm trying the OS functions, too, but they're not working. Forget my stupidity.

Adriweb

September 12, 2016, 05:13:03 pm #11 Last Edit: September 12, 2016, 05:27:37 pm by Adriweb
Quote from: MateoConLechuga on September 11, 2016, 10:33:31 pm4. I don't believe there are any platformer games yet; but anything you learn or discover along the way would be neat :)

Wut

Androides , Crystann , Billybox



All open-source btw.

Android has "gravity", as you can see the character falling, for instance, and not tile-by-tile (contrary to the two others, where everything is by tile)
Co-founder & co-administrator of TI-Planet and Inspired-Lua

JWinslow23

I've implemented collision functions that work well enough for me.



Interaction with objects will come next. I suppose I'll work on dying, then pushing the button. And at some point, the guy's got to turn around when he walks left.

Download attached.

kotu

SUBSCRIBE TO THE FUTURERAVE.UK MAILING LIST
http://futurerave.uk

JWinslow23

Quote from: kotu on September 12, 2016, 06:39:21 pm
is he a little elephant?

Yes, he is. You can play the original I'm basing this off of here.

I'll also try to see if I can get the creator's blessing for doing a full version of my color remake. I probably won't need it, but I'll tell him anyways.

Powered by EzPortal