* WalrusIRC

You need to have 5 posts and not be part of restricted usergroups in order to use the WalrusIRC embedded shoutbox. However, you can also access our IRC channel called #CodeWalrus via EFnet.

Author Topic: SwipeCE - A Swipe Arrows Port for the TI 84+ CE  (Read 1269 times)

0 Members and 1 Guest are viewing this topic.

Offline Unicorn

  • ??? ??? ??? ??? ???
  • Super User
  • CW Contest II - 2nd place
  • *
  • Join Date: Jan 2015
  • Location: ??? ??? ??? ??? ???
  • Posts: 2825
  • Post Rating Ratio: +5/-2
  • make :PICKACHUP: a thing!
    • Unicorn808
    • 114/11432
    • ??? ??? ??? ??? ???
  • Gender: Male
SwipeCE - A Swipe Arrows Port for the TI 84+ CE
« on: May 06, 2016, 07:33:30 pm »
For the past week or so, I've been working on porting this game to the CE. I've finished it, more or less.

There is only one mode, the main one, and and there is no color mode. It does have a Highscore System, though!
The other gameplay and color modes are planned, and should come out soon :)

Screenshot:



Code: [Select]
//--------------------------------------
// 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 <graphc.h>
#include <keypadc.h>
#include <debug.h>
#include <fileioc.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 spritePal();
void inGame();
void menu();
void loadHS();
void setHS();
/* Put all your globals here. */
int key, key1, keyPress, swipe, rightSwipe, score = 0, color = 255, timer, timerStart, press;
ti_var_t file;
uint8_t highscore;
bool correct, keyTouched;
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void main(void) {
loadHS();
menu();
gc_FillScrn(255);
gc_CloseGraph();
pgrm_CleanUp();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void setHS(void) {
if (score >= highscore) {
highscore = score;
    /* Close all open file handles before we try any funny business */
    ti_CloseAll();
     
    /* Open a file for writting*/
    file = ti_Open("swipehigh", "w");
     
    /* write some things to the file */
    if (file)
         ti_Write(&highscore, sizeof(highscore), 1, file); 
}
}
void loadHS(void) {
ti_CloseAll();
file = ti_Open("swipehigh", "r");
if (file) {
ti_Read(&highscore, sizeof(highscore), 1, file);
    }   
    else {
    highscore = 0;
    }

}
void menu(void) {
setHS();
gc_InitGraph();
gc_FillScrn(255);
gc_InitGraph();
gc_SetTextColor(0 | (255 << 8));
gc_PrintStringXY("Swipe Arrow", 120, 1);
gc_SetTextColor(192 | (255 << 8));
gc_PrintStringXY("2nd to start", 118, 10);
gc_PrintStringXY("Clear to exit", 117, 20);
gc_PrintStringXY("Highscore:", 117, 50);
gc_SetTextXY(195, 50);
gc_PrintInt(highscore, 3);
gc_SetPalette(sprites_pal, sizeof(sprites_pal));
gc_NoClipDrawTransparentSprite(uparrow,120, 100, 75, 75);
srand(rtc_Time());
score = 0;
while (kb_ScanGroup(kb_group_6) != kb_Clear) {
if (keyPress % 15 == 0) {
if (key1 & kb_2nd)
inGame();
}
keyPress++;
key = kb_ScanGroup(kb_group_7); //Arrow Keys
    key1 = kb_ScanGroup(kb_group_1);  //2nd
}
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void inGame(void) {
gc_InitGraph();
gc_FillScrn(255);
gc_SetColorIndex(23);
rightSwipe = gc_RandInt(1,8);
timerStart = 30;
timer = timerStart;
while (kb_ScanGroup(kb_group_6) != kb_Clear) {
if (keyPress % 15 == 0) {
timer--;
if (key & kb_Up) {
swipe = 1;
keyTouched = true;
press++;
}
if (key & kb_Down) {
swipe = 2;
keyTouched = true;
press++;
}
if (key & kb_Right) {
swipe = 3;
keyTouched = true;
press++;
}
if (key & kb_Left) {
swipe = 4;
keyTouched = true;
press++;
}
if (key & kb_Up && rightSwipe >= 5) {
swipe = 5;
keyTouched = true;
press++;
}
if (key & kb_Down && rightSwipe >= 5) {
swipe = 6;
keyTouched = true;
press++;
}
if (key & kb_Right && rightSwipe >= 5) {
swipe = 7;
keyTouched = true;
press++;
}
if (key & kb_Left && rightSwipe >= 5) {
swipe = 8;
keyTouched = true;
press++;
}
if (rightSwipe == swipe && keyTouched == true) {
correct = true;
keyTouched = false;
timer = timerStart;
}
if (rightSwipe != swipe && keyTouched == true || timer <= 0) {
keyTouched = false;
gc_InitGraph();
gc_FillScrn(255);
gc_PrintStringXY("You Lost",120,5);
while (kb_ScanGroup(kb_group_1) != kb_2nd) {
}
menu();
}
if (correct == true) {
rightSwipe = gc_RandInt(1,8);
gc_InitGraph();
gc_SetColorIndex(color);
gc_NoClipRectangle(120,80,75,75);
score++;
correct = false;
}
}
if (rightSwipe == 1) {
spritePal();
gc_NoClipDrawTransparentSprite(uparrow,120, 80, 75, 75);
}
if (rightSwipe == 2) {
spritePal();
gc_NoClipDrawTransparentSprite(downarrow,120, 80, 75, 75);
}
if (rightSwipe == 3) {
spritePal();
gc_NoClipDrawTransparentSprite(rightarrow,120, 80, 75, 75);
}
if (rightSwipe == 4) {
spritePal();
gc_NoClipDrawTransparentSprite(leftarrow,120, 80, 75, 75);
}
if (rightSwipe == 6) {
spritePal();
gc_NoClipDrawTransparentSprite(uparrowWrong,120, 80, 75, 75);
}
if (rightSwipe == 5) {
spritePal();
gc_NoClipDrawTransparentSprite(downarrowWrong,120, 80, 75, 75);
}
if (rightSwipe == 8) {
spritePal();
gc_NoClipDrawTransparentSprite(rightarrowWrong,120, 80, 75, 75);
}
if (rightSwipe == 7) {
spritePal();
gc_NoClipDrawTransparentSprite(leftarrowWrong,120, 80, 75, 75);
}
if (press == 10 && timerStart > 7) {
timerStart = timerStart - 5;
press = 0;
}

gc_SetColorIndex(255);
gc_NoClipRectangle(1,1,16,16);
gc_SetTextXY(1,1);
gc_PrintInt(score, 3);
keyPress++;
key = kb_ScanGroup(kb_group_7); //Arrow Keys
    key1 = kb_ScanGroup(kb_group_1);  //2nd
}
menu();
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void spritePal(void) {
gc_SetPalette(sprites_pal, sizeof(sprites_pal));
}
/* Put other functions here */
« Last Edit: May 09, 2016, 09:59:22 pm by Unicorn »


  • Calculators owned: I own all of them: PICKACHUP TI 84+ CSE TI 83+ SE TI something something ??? ??? ??? ??? ???
  • Consoles, mobile devices and vintage computers owned: PICKACHUP ??? ??? ??? ??? ???



??? ??? ??? ??? ???

Offline xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18875
  • Post Rating Ratio: +99/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Nice, I never played that gaame before so I need to check how to play before giving feedback, but it seems like a cool idea :3=
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Unicorn

  • ??? ??? ??? ??? ???
  • Super User
  • CW Contest II - 2nd place
  • *
  • Join Date: Jan 2015
  • Location: ??? ??? ??? ??? ???
  • Posts: 2825
  • Post Rating Ratio: +5/-2
  • make :PICKACHUP: a thing!
    • Unicorn808
    • 114/11432
    • ??? ??? ??? ??? ???
  • Gender: Male
Nice, I never played that gaame before so I need to check how to play before giving feedback, but it seems like a cool idea :3=
Thanks!

I just updated it, I completed the timer and tweaked it, now I need to figure out how to use palettes to change colors...
  • Calculators owned: I own all of them: PICKACHUP TI 84+ CSE TI 83+ SE TI something something ??? ??? ??? ??? ???
  • Consoles, mobile devices and vintage computers owned: PICKACHUP ??? ??? ??? ??? ???



??? ??? ??? ??? ???

Offline xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18875
  • Post Rating Ratio: +99/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
By the way, I didn't have time to try it yet but is there a time limit to press each arrow? Also how would color-based gameplay work?
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Unicorn

  • ??? ??? ??? ??? ???
  • Super User
  • CW Contest II - 2nd place
  • *
  • Join Date: Jan 2015
  • Location: ??? ??? ??? ??? ???
  • Posts: 2825
  • Post Rating Ratio: +5/-2
  • make :PICKACHUP: a thing!
    • Unicorn808
    • 114/11432
    • ??? ??? ??? ??? ???
  • Gender: Male
Yup, there is a time limit, which decreases ever 10 points, and color based would just change the colors ever 20 points ;)
  • Calculators owned: I own all of them: PICKACHUP TI 84+ CSE TI 83+ SE TI something something ??? ??? ??? ??? ???
  • Consoles, mobile devices and vintage computers owned: PICKACHUP ??? ??? ??? ??? ???



??? ??? ??? ??? ???

Offline xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18875
  • Post Rating Ratio: +99/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
I was more curious about what colors actually do in the game. :P
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline Unicorn

  • ??? ??? ??? ??? ???
  • Super User
  • CW Contest II - 2nd place
  • *
  • Join Date: Jan 2015
  • Location: ??? ??? ??? ??? ???
  • Posts: 2825
  • Post Rating Ratio: +5/-2
  • make :PICKACHUP: a thing!
    • Unicorn808
    • 114/11432
    • ??? ??? ??? ??? ???
  • Gender: Male
Update: Added color, I'm working on color changing and other modes.


Download in the OP
  • Calculators owned: I own all of them: PICKACHUP TI 84+ CSE TI 83+ SE TI something something ??? ??? ??? ??? ???
  • Consoles, mobile devices and vintage computers owned: PICKACHUP ??? ??? ??? ??? ???



??? ??? ??? ??? ???

Offline xlibman

  • Omni founder & CW co-founder
  • Super User
  • Original 5
  • CodeWalrus Supporter
  • *
  • Join Date: Nov 2014
  • Location: Quebec, Canada
  • Posts: 18875
  • Post Rating Ratio: +99/-4
    • dj_omnimaga
    • DJOmnimaga.music
    • @DJOmnimaga
    • dj_omnimaga
    • @DJOmnimaga
    • /u/DJ_Omnimaga
    • DJOmnimaga
    • 112/11286
    • @djomnimaga
    • @DJOmnimaga
    • DJ Omnimaga music store
  • Gender: Male
Cool, I'll give it a try soon :)
  • Calculators owned: TI-57, 73, TI-80 (broken), TI-81, TI-82, TI-83, TI-83+ (broken), TI-83+ (broken), TI-83+SE (broken), TI-84+, TI-84+CSE, TI-84+CE, TI-85, TI-86, TI-89T, TI-92, TI-Nspire, TI-Nspire CX (semi-broken), HP 39gII, HP Prime, Casio fx-7000G, fx-7400G+, fx-7700GE, fx-9750G+, fx-9750GII, fx-9860G, cfx-9850G, FX-1.0+, fx-CG10, fx-CP400
  • Consoles, mobile devices and vintage computers owned: Samsung i5510, Nexus 5, Atari 2600, Lynx, SMS, Game Gear, Genesis, Dreamcast, NES, SNES, N64, GCN, Wii, Wii U, GBA, DS, 3DS, PS2, PS3, PS4, PSP, PSVita, XBox 360, XBOne

Bandcamp|Reverbnation|Facebook|Youtube|Twitter
Retired Omnimaga admin (2001-11) and editor (2012-14)

Offline alexgt

  • Just your friendly neighborhood Ninja Stach Fancy Iron Man
  • Super User
  • Join Date: Dec 2014
  • Location: Behind you
  • Posts: 2611
  • Post Rating Ratio: +6/-1
  • Something should go here...
    • /u/alexgt9123
  • Gender: Male
Looks nice Unicorn ;)
  • Calculators owned: Ti-84+, Ti-Nspire, Hp Prime, Broken HP Prime, HP 48SX

Offline Jkolade936

  • All Around Coolio
  • Super User
  • Join Date: Jan 2016
  • Location: Horseheads, NY
  • Posts: 1515
  • Post Rating Ratio: +9/-1
  • I'm an unknown loner. I try to change that.
    • Jkolade936
    • My Sprites and Walrii Collection
  • Gender: Male
That's cool. :)
  • Calculators owned: None of them. :'(
Does this qualify as a signature? 
The answer is "Sure."


 


You can also use the following HTML or bulletin board code to share it on your page or forum signature!


Also do not forget to check our affiliates below.
Planet Casio TI-Planet Calc.news BroniesQC BosaikNet Velocity Games