Alright, so I'm going to enter the contest. My idea is to make a game called train rush (similar to minion rush) made in C for the TI-84+ CE. Its a train moving trough a track that will continualy split paths. You will have to jump over and duck under obstacles, and get train parts along the way.
So, I know the C language very well now, so all I need to find out is the calculator specific graphics, keypad, and fileio commands and operations for the C libraries. I will also need the command for generating a random number. Thanks!
That sounds like a fun game idea; I look forward to seeing how it progresses. You can ask questions here / elsewhere on the forum about using the libraries, and there's also some documentation (ish) in the relevant GitHub repo:
https://github.com/CE-Programming/libraries/blob/master/graphics/graphics_src/graphx/v2/graphx.h
Thanks, Kerm! This is exactly what I'm looking for. Also, what does it mean if the command includes "no_clip"? I have seen it used before, but I don't know the difference from the original command.
Alright, first coding question. I'm working on the random function and it keeps returning an error. Its probably some stupid mistake I made.
Code: void random(void){
randnum=randInt(1,3);
if (randnum==1){
drawobst_up();
}
if (randnum==2){
drawobst_down();
}
if (randnum==3){
splittrack();
}
}
Does any one see an error?
You should take a look at which line the error is, but with my very limited C acknowledge, I think it should be "void random() {".
randnum doesn't have a type specifier. Hope this helps
Oh, wait, I figured it out!I cleared it out so I could start clean, and I forgot to re-add the main function. Yep, it was a stupid mistake.
It compiles normally now.
How do you set up the graphics? I've tried, but I cant get any thing to work.
calcnerd_CEP_D wrote:
How do you set up the graphics? I've tried, but I cant get any thing to work.
Use the graphics_examples' demos to figure out how to use the graphx library. This is how my program sets it up:
Code: /* 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>
/* Shared libraries */
#include <lib\ce\graphx.h>
#include "gfx\map_gfx.h"
#include "gfx\train_gfx.h"
//global variables
uint24_t train_x;
uint24_t train_y;
void main(void)
{
//setup
gfx_Begin(gfx_8bpp);
gfx_SetPalette(map_gfx_pal, sizeof(map_gfx_pal), 0);
gfx_SetPalette(train_gfx_pal, sizeof(train_gfx_pal), 0);
You want to make sure you include all of the header's (especially this one:#include <lib\ce\graphx.h>). Don't include the gfx header's in my code, those are my own personal sprites. Make your own if you want.
Well, its been a while since I've worked on this project. I'm currently working with the graphics, and when I tried adding a circle, it reset the emulator. I have all of the libraries needed, so it isn't that. I'm sure its just something dumb that I did, but I can't figure it out.
Code: gfx_FillCircle_NoClip(10,10,10);
Did you call gfx_begin( 8bpp ); ? If you already did, you could try a circle with clipping. Also you may want to remove debug commands - they have caused weird crashes that only occur at a certain time.
If its none of those try posting all of your code.
I've been doing some more work on this, and I've come up with a to do list. The biggest obstacle now is drawing the train sprite. Once I get that done, I can finish the main mechanics of the game.
To Do:
▪Obstacle Sprite and Mechanics
Done:
▪Background
▪Train Jumping
▪The Train Sprites
▪Key Presses
EDIT: Since schools starts in 3 days, I'm going to have to finish it up. This means a bit less in the game.
Ooo sounding good! If you need help with sprites, do no hesitate to ask, they are actually quite easy to work.
Same goes for everything else.
Be sure to check the examples as well, they really help out.
I'd imagine that the train sprite is the least technically challenging part of that list, just the most artistically challenging. One helpful suggestion might be to use a random placeholder sprite for now, work on the code, and either solicit help with creating a train sprite or work on refining it once the code is done. Good luck!
I made the image, and now its saved as a png. How would I turn that into a sprite? Also, how would I post a picture?
PT_ wrote:
I think it should be "void random() {".
I don't; It should be void random(void) if you are programming in C. See http://stackoverflow.com/questions/5929711/c-function-with-no-parameters-behavior.
Isnt there something called convPNG that turns PNGs into C sprites? How do I use it?
It's really easy! ConvPNG is already included in Mateo's toolchain.
Just create a file called convpng.ini that looks like this:
Code: #GroupC: gfx_group_1
#PNGImages:
image1
image2
The GroupC directive specifies the name of the resulting C file and sprite group. PNGImages specifies the images which that group consists of. Other directives are optional but you can have a look at them here.
After creating convpng.ini alongside your images, just fire up ConvPNG. The best way to invoke it is by opening a Command Prompt window in the directory where convpng.ini is (shift+right click, "Open command window here"), and then dragging ConvPNG.exe to the command prompt window, and pressing Enter. Now the .c and .h files are generated. To use the sprites you made, just #include the .h file in any applicable source code.
Ok, I've created the sprite and implemented it into my program. How would I use it?
If you look in the header that defines all of the sprites you use, usually ends in _gfx.h, it uses #define sprite ((gfx_image_t*)sprite_data). Use the define: sprite, in Mateo's Sprite functions in graphx.h.