Author Topic: Tunnel - by ClrDraw  (Read 9870 times)

0 Members and 2 Guests are viewing this topic.

Offline ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Tunnel - by ClrDraw
« on: November 02, 2013, 02:34:42 pm »
Check out the screenshots for my Tunnel game! Made with Axe 1.2.2. The tunnel gets smaller by one pixel every few seconds until it is about twenty pixels wide. Game is completely random every time you play.
File is attached if you want to download.
« Last Edit: November 07, 2013, 08:13:58 pm by ClrDraw »
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline mdr1

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 303
  • Rating: +21/-2
    • View Profile
Re: Tunnel - by ClrDraw
« Reply #1 on: November 02, 2013, 03:16:25 pm »
Good start !



Offline AssemblyBandit

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 374
  • Rating: +60/-1
  • ~AssemblyBandit~
    • View Profile
    • briandm82.com
Re: Tunnel - by ClrDraw
« Reply #2 on: November 02, 2013, 04:00:41 pm »
Damn ClrDraw! It was like just yesterday when you signed up! Nice job on getting stuff out so quick and nice game! +1

Offline TheCoder1998

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 434
  • Rating: +20/-2
  • my art is written in code, not in graphite
    • View Profile
    • My website :D
Re: Tunnel - by ClrDraw
« Reply #3 on: November 02, 2013, 04:01:49 pm »
looks great, i'm gonna try to program that myself too.
as a kind of exercise ya know  ;D
my ticalc acc:

http://www.ticalc.org/archives/files/authors/113/11365.html

Spoiler For The Best Song Ever:


follow me on tumblr :)
www.rickdepizza.tumblr.com

check out my anilist :D
http://anilist.co/animelist/29701/Rickdepizza

Offline ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Re: Tunnel - by ClrDraw
« Reply #4 on: November 02, 2013, 04:10:43 pm »
Lol, thanks!!!  8) I'm adding a few projects I finished a few months before I joined!
« Last Edit: November 02, 2013, 04:24:15 pm by ClrDraw »
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Tunnel - by ClrDraw
« Reply #5 on: November 02, 2013, 04:38:25 pm »
Sweet, tunnel games are always fun :D

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Re: Tunnel - by ClrDraw
« Reply #6 on: November 02, 2013, 10:37:40 pm »
They are, and it was surprisingly easier to program than many other things I've made!

Spoiler For how it works:
It's one loop, looping through...
the draw subroutine
1. moves everything one pixel to the left
2. random integer 0 or 1, if 0 then the tunnel will move up one and if 1 than the tunnel will move down 1
3. draws the tunnel on the last column (96)
4. every 400 frames makes the Tunnel size one pixel smaller
5. displays graph
6. removes sprite of triangle
the key subroutine
1. if up or down arrows are pressed, moves triangle up or down
2. if clear is pressed, exits
3. pauses the program if on key is pressed, show pause screen
the check subroutine
if there is a pixel where the triangle sprite will be, then gotoEND (player loses, shows high score)
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: Tunnel - by ClrDraw
« Reply #7 on: November 03, 2013, 09:19:44 am »
Yeah a tunnel game is a good way to try out a new programming language. It kinda is a benchmark here in the calculator community :P The HP Prime's basic was compared with the CSE one by writing a tunnel game for both of the calcs and playing them side by side.
If you like my work: why not give me an internet?








Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Tunnel - by ClrDraw
« Reply #8 on: November 03, 2013, 09:48:15 am »
Scrolling up/down might actually be about 60% faster than left/right, too. (about 16000 clock cycles versus about 26000).

Offline ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Re: Tunnel - by ClrDraw
« Reply #9 on: November 03, 2013, 10:41:25 am »
I didn't include left and right. Is that normal to have in a tunnel game?
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline Keoni29

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2466
  • Rating: +291/-16
    • View Profile
    • My electronics projects at 8times8
Re: Tunnel - by ClrDraw
« Reply #10 on: November 03, 2013, 11:38:19 am »
No he is talking about scrolling the screen vertically vs horizontally :)
If you like my work: why not give me an internet?








Offline ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Re: Tunnel - by ClrDraw
« Reply #11 on: November 03, 2013, 12:58:23 pm »
OH is it really faster? That's really good to know, cause the game is a little slow and I want to speed it up.
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Tunnel - by ClrDraw
« Reply #12 on: November 03, 2013, 01:04:56 pm »
It is indeed :) Here, check this out and click the little button thing at the bottom to show speed/size for various outputs.

It turns out my estimates were off, though, and it is actually even faster than I predicted :P

Offline ClrDraw

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 627
  • Rating: +61/-2
    • View Profile
    • GitHub
Re: Tunnel - by ClrDraw
« Reply #13 on: November 03, 2013, 01:11:33 pm »
Wow that's nce, I'd never paid attention to the size/speed numbers on the right before! I wonder why it's so much faster though?
Visit my GitHub for all my TI programs as well as other projects.
Also check out my website.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: Tunnel - by ClrDraw
« Reply #14 on: November 03, 2013, 01:18:32 pm »
Internally, the calculator stores the screen buffer as a 768 byte array. Each byte corresponds to 8 pixels (8 bits per byte) and the screen is horizontally aligned, meaning the first 12 bytes (96 pixels) correspond to the top row and it works down the screen from there.

To scroll the screen down or up, we only need to shift 12 bytes which is pretty easy to do-- there is an instruction that lets us copy a number of bytes from one location to another, removing a lot of overhead code.

To scroll the screen left or right, we need to shift by 1 pixel and there is no easy instruction to do that. In fact rotating or shifting bits requires an extension of the instruction set, which makes it even slower to rotate by bits. (shifting by 8 pixels left or right is much easier as that becomes once again, shifting the buffer by a byte, which is easy)