Author Topic: Horse racing game HELP ^^''  (Read 18831 times)

0 Members and 2 Guests are viewing this topic.

Offline Gale

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 115
  • Rating: +1/-0
  • Ti-84+ Silver Edition
    • View Profile
Horse racing game HELP ^^''
« on: March 13, 2010, 11:18:36 am »
Heyyy guys! I'm new to the forum  :P Anywayy, i'm not sure if we're supposed to do BASIC code in a special box when posting like on other forums, but here i goooo.
I'm making a horse racing game for my calculator, which involves selecting one of five horses (i had a friend do cool graphics for each one :3), and placing a bet on a horse . I've made the racing animation work, yet it takes up tonsss of memory, because it wanted to have the winning horse in front of the others in each animation. So, being the TI-noob that i am, i made a seperate race code for each horses' victory. Is there anyway I can shrink it down to code for just one race? Here it is:

:ClrHome
:ClrDraw
:randInt(1,5)->R
:If R=1:Then
:ClrHome
:For(X,2,16)   //it's starting at 2 so the other horses can be "behind" the lead horse
:Output(2,X,"o  //row #2 is first lane so the race is more in the center of the screen
:Output(3,X-1,"o
:Output(4,X-1,"o
:Output(5,X-1,"o
:Output(6,X-1,"o
:For(Y,1,150)
:End
:Output(2,X," "
:Output(3,X-1," "
:Output(4,X-1," "
:Output(5,X-1," "
:Output(6,X-1," "
:End
:Goto AE     //the victory scene is on lbl AE
:End

Now this code would be repeated for all 5 potential R values (each horse). Is there any way I can avoid repeating this code, but still have one horse winning? (In this case, the horse in lane 1 won)
remember me as a time of day...

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Horse racing game HELP ^^''
« Reply #1 on: March 13, 2010, 11:24:50 am »
Welcome here! ;D

I think it would be easiest to help you if you put the complete winning animation code up here.  You can put it in the little code box by typing [code ] and then [/code ] (without the spaces in there) at the end. :)

Good luck!  I'll (and everyone else) try to help you once I can tell what the other horses do. :D


Edit: Here's a fix:

:randInt(1,5)->R
:ClrHome
:For(X,1,15)   //it's starting at 1 so the other horses can be "behind" the lead horse, but you don't have to change their values.
:Output(2,X+(R=1),"o  //row #2 is first lane so the race is more in the center of the screen
:Output(3,X+(R=2),"o
:Output(4,X+(R=3),"o
:Output(5,X+(R=4),"o
:Output(6,X+(R=5),"o
:For(Y,1,150)
:End
:Output(2,X+(R=1)," "
:Output(3,X+(R=2)," "
:Output(4,X+(R=3)," "
:Output(5,X+(R=4)," "
:Output(6,X+(R=5)," "
:End
:Goto AE     //I'm not sure here, but it's here because it's in your code. :)
« Last Edit: March 13, 2010, 11:29:03 am by ztrumpet »

Offline Gale

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 115
  • Rating: +1/-0
  • Ti-84+ Silver Edition
    • View Profile
Re: Horse racing game HELP ^^''
« Reply #2 on: March 13, 2010, 11:34:51 am »
I'll have to test it out later because i'm going bowling now, but the syntax makes sense!!

thank you!!!

oh, is there a way to convert pictures to code efficiently? i got a pic-to-program converter on the TI website, but it's terrible with memory because it turns on each individual pxl, and an error always pops up halfway through converting.
because i dont want to have to upload each individual pic along with the main program when sending it to other people.
remember me as a time of day...

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Horse racing game HELP ^^''
« Reply #3 on: March 13, 2010, 11:44:39 am »
It's probably best to make them Pics because it will be fastest this way.  I don't mind that much, and if you think multiple files are bad, they aren't, so you can use pics if you want. :D

Oh, and there is not an easily used pic converter program out there, plus if you try to convert a pic it will get much larger and it will be a lot slower.  If you still want to not use Pics, then I'd try Vertical Text Sprites: http://ourl.ca/4059


Good luck!

Offline Gale

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 115
  • Rating: +1/-0
  • Ti-84+ Silver Edition
    • View Profile
Re: Horse racing game HELP ^^''
« Reply #4 on: March 13, 2010, 11:46:12 am »
i've heard of text sprites before, but they looked too confusing for me. i'll give them a try  ;D

thank you!
remember me as a time of day...

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Horse racing game HELP ^^''
« Reply #5 on: March 13, 2010, 04:58:28 pm »
Wouldn't the use of text sprites (horizontal or vertical) depend on the size of the animation?
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Horse racing game HELP ^^''
« Reply #6 on: March 13, 2010, 07:19:07 pm »
i'm not sure if we're supposed to do BASIC code in a special box when posting like on other forums
It is recommended, since it's easier to read, but it's not necessary. Just always make sure to disable smileys if you don't use these boxes because some of your code will turn into emoticons.

Welcome here btw :)

Offline Gale

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 115
  • Rating: +1/-0
  • Ti-84+ Silver Edition
    • View Profile
Re: Horse racing game HELP ^^''
« Reply #7 on: March 13, 2010, 11:37:44 pm »
thank you :D

and i still don't understand text sprites. so they're used to make "blocks" of pixels appear on the graph screen?
remember me as a time of day...

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Horse racing game HELP ^^''
« Reply #8 on: March 13, 2010, 11:44:23 pm »
I still don't get vertical text sprites myself x.x

Sadly, though, these ones are no longer really efficient, though, with OS 2.53 and Nspire OS 2.0, because they won't show properly on these OS.

Offline Gale

  • LV4 Regular (Next: 200)
  • ****
  • Posts: 115
  • Rating: +1/-0
  • Ti-84+ Silver Edition
    • View Profile
Re: Horse racing game HELP ^^''
« Reply #9 on: March 13, 2010, 11:52:09 pm »
ohh. yeah, i accidentally downgraded my OS on my TI-84+ to a 2.22 from a 2.53 last night xD
remember me as a time of day...

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Horse racing game HELP ^^''
« Reply #10 on: March 13, 2010, 11:55:44 pm »
Mhmm, I would recommend maybe getting the latest possible that is under 2.53MP if you can find one, though, in case older ones may have bugs. The latest is 2.43, if I remember. Again, though, it's not a big hurry if you regulary perform backups.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Horse racing game HELP ^^''
« Reply #11 on: March 14, 2010, 10:56:52 am »
Nice. ;D

I'd recommend 2.43 unless you use your calc only for math, when I'd recommend 2.53MP. :D

Offline JoeyBelgier

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 545
  • Rating: +25/-21
  • Joey
    • View Profile
Re: Horse racing game HELP ^^''
« Reply #12 on: March 14, 2010, 08:51:22 pm »
i dont want to have to upload each individual pic along with the main program when sending it to other people.

Working with pic's will be the fastest tho in pure basic. The solution for not having to send individual files equalz Grouping them after all code is done/all art is made.

BTW, welcome here (:

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Horse racing game HELP ^^''
« Reply #13 on: March 14, 2010, 08:58:35 pm »
Sometimes to have complex games you have no choice but have people sacrify memory and possibly have the install process more complicated, because otherwise your games might just be too simple. You will probably have to group the pics with the program so they can be sent easier

Offline JoeyBelgier

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 545
  • Rating: +25/-21
  • Joey
    • View Profile
Re: Horse racing game HELP ^^''
« Reply #14 on: March 14, 2010, 09:05:02 pm »
I already said that, like, one post ago q:
EDIT; No wait, now it's 2 posts ago

and yay, this is my 444th, finally

EDIT2: It's prolly just me, but I don't see the offensive side off this. Then again, at least 2 others did..
So I'm off again.. <_< Ciao
« Last Edit: March 14, 2010, 09:35:16 pm by NecroF-_-ckk »