Join us on Discord!
You can help CodeWalrus stay online by donating here.

[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 3 Guests are viewing this topic.

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 :)

Dream of Omnimaga

Glad to see a color version @JWinslow23 :D . I am definitively looking forward for it. How fast does it run so far?
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

JWinslow23

#3
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.

Dream of 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.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

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.

Dream of Omnimaga

  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

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

#10
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

#11
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)
  • Calculators owned: TI-Nspire CX CAS, TI-Nspire CX, TI-Nspire CAS (x3), TI-Nspire (x2), TI-Nspire CM-C CAS, TI-Nspire CAS+, TI-80, TI-82 Stats.fr, TI-82 Plus, TI-83 Plus, TI-83 Plus.fr USB, TI-84+, TI-84+ Pocket SE, TI-84+ C Silver Edition, TI-84 Plus CE, TI-89 Titanium, TI-86, TI-Voyage 200, TI-Collège Plus, TI-Collège Plus Solaire, 3 HP, some Casios
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

  • Calculators owned: TI 84+CE-T
  • Consoles, mobile devices and vintage computers owned: Sega Master System, Sony PlayStation 3
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