- Subway surfers on ti 84 plus ce[*And also how to program in C*]
- 17 Feb 2026 09:44:29 am
- Last edited by calcgeek on 18 Feb 2026 01:30:33 pm; edited 1 time in total
I am making a subway surfers game in C but I can't convert the code to the calculator format on my laptop so can someone please convert the following code. by the way this code is in C. I used claude so it might be horrible.
Code:
Code:
#include <tice.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SCREEN_WIDTH 320
#define SCREEN_HEIGHT 240
// Draw animated subway train
void drawTrain(int offset) {
// Train body
gfx_FillRectangle(50 + offset, 30, 80, 25, 224); // Cyan
gfx_Rectangle(50 + offset, 30, 80, 25, 255); // White border
// Windows
for (int i = 0; i < 3; i++) {
gfx_FillRectangle(60 + (i * 20) + offset, 35, 12, 12, 16); // Dark windows
}
// Wheels
gfx_FillCircle(65 + offset, 60, 5, 255); // White wheels
gfx_FillCircle(115 + offset, 60, 5, 255);
}
// Draw player character
void drawPlayer(int x, int y) {
// Head
gfx_FillCircle(x, y - 10, 5, 224); // Cyan
// Body
gfx_FillRectangle(x - 3, y - 5, 6, 8, 51); // Blue
// Legs
gfx_FillRectangle(x - 2, y + 3, 2, 5, 224); // Cyan legs
gfx_FillRectangle(x + 1, y + 3, 2, 5, 224);
}
// Draw obstacle
void drawObstacle(int x, int y) {
gfx_FillRectangle(x, y, 15, 20, 226); // Red obstacle
gfx_Rectangle(x, y, 15, 20, 255); // White border
}
// Draw animated background (moving tracks)
void drawTracks(int offset) {
gfx_SetTextFG(160); // Gray
for (int i = 0; i < 15; i++) {
int y = 120 + (i * 15) - (offset % 15);
gfx_HorizLine(0, y, SCREEN_WIDTH, 160);
}
// Vertical track dividers
gfx_VertLine(100, 80, 160, 160);
gfx_VertLine(200, 80, 160, 160);
}
// Draw gradient background
void drawBackground(void) {
// Sky gradient (blue to darker blue)
for (int y = 0; y < 100; y++) {
int color = 32 + (y / 8);
gfx_HorizLine(0, y, SCREEN_WIDTH, color);
}
// Ground area (darker)
gfx_FillRectangle(0, 100, SCREEN_WIDTH, 140, 16);
}
// Draw main title with style
void drawTitle(void) {
gfx_SetTextScale(3, 3);
gfx_SetTextFG(224); // Bright cyan
gfx_PrintStringXY("SUBWAY", 90, 15);
gfx_PrintStringXY("SURFERS", 85, 35);
gfx_SetTextScale(1, 1);
gfx_SetTextFG(226); // Red accent
gfx_PrintStringXY(">> CE <<", 135, 55);
}
// Draw menu button
void drawMenuButton(int x, int y, int width, int height, const char *text, int selected) {
if (selected) {
// Neon glow effect for selected
gfx_FillRectangle(x - 2, y - 2, width + 4, height + 4, 224); // Cyan glow
gfx_FillRectangle(x, y, width, height, 51); // Blue button
gfx_SetTextFG(255); // White text
} else {
gfx_FillRectangle(x, y, width, height, 33); // Dark cyan
gfx_SetTextFG(224); // Cyan text
}
// Border
gfx_Rectangle(x, y, width, height, 224);
// Draw text centered
gfx_SetTextScale(1, 1);
int textLen = strlen(text);
int textX = x + (width / 2) - (textLen * 3);
int textY = y + (height / 2) - 4;
gfx_PrintStringXY(text, textX, textY);
}
// Draw stats panel
void drawStatsPanel(void) {
gfx_FillRectangle(10, 75, 140, 40, 16); // Dark background
gfx_Rectangle(10, 75, 140, 40, 224); // Cyan border
gfx_SetTextScale(1, 1);
gfx_SetTextFG(224); // Cyan text
gfx_PrintStringXY("HIGH SCORE: 15420", 15, 80);
gfx_PrintStringXY("COINS: 2840", 15, 92);
}
int main(void) {
gfx_Begin();
gfx_SetDrawBuffer();
int selected = 0;
int numOptions = 3;
int animOffset = 0;
int frameCount = 0;
while (1) {
frameCount++;
animOffset = frameCount % 100;
// Draw background
drawBackground();
// Draw animated tracks
drawTracks(animOffset);
// Draw animated train at top
drawTrain(-150 + animOffset);
// Draw title
drawTitle();
// Draw stats
drawStatsPanel();
// Draw menu buttons
const char *options[] = {"PLAY GAME", "SETTINGS", "EXIT"};
for (int i = 0; i < numOptions; i++) {
int y = 130 + (i * 35);
drawMenuButton(70, y, 180, 28, options[i], (i == selected));
}
// Draw footer instructions
gfx_SetTextScale(1, 1);
gfx_SetTextFG(160); // Gray
gfx_PrintStringXY("UP/DOWN to select | ENTER to play", 50, 235);
gfx_SwapDraw();
// Handle input
kb_Scan();
if (kb_Data[6] & kb_Up) {
selected--;
if (selected < 0) selected = numOptions - 1;
delay(150);
}
if (kb_Data[6] & kb_Down) {
selected++;
if (selected >= numOptions) selected = 0;
delay(150);
}
if (kb_Data[6] & kb_Enter) {
gfx_End();
switch (selected) {
case 0:
// Launch game
break;
case 1:
// Settings
break;
case 2:
// Exit
break;
}
return 0;
}
if (kb_Data[6] & kb_Clear) {
gfx_End();
return 0;
}
}
gfx_End();
return 0;
}












