Author Topic: Pacman Nspire  (Read 33290 times)

0 Members and 1 Guest are viewing this topic.

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Pacman Nspire
« Reply #60 on: August 25, 2011, 03:59:44 am »
Quote from: pianoman
Pianoman, a tip to speed it up: change the white in the sprites with alpha (if you don't do this aready)
Wait, what? :P

Well, with alpha I mean transparency. The image draw routine will just skip the pixels instead of decoding the color value and drawing it. I used this in my card game, and I got almost 500% speedup (there is allot of white in the cards).
You can change the white to alpha with my online sprite editor ;D
« Last Edit: August 25, 2011, 04:00:25 am by jimbauwens »

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: Pacman Nspire
« Reply #61 on: August 25, 2011, 11:26:55 pm »
Hmmm, interesting.
However, the ghosts aren't TI.Images :w00t:
Will that still work?

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: Pacman Nspire
« Reply #62 on: August 25, 2011, 11:57:58 pm »
What are they? ???

Offline fb39ca4

  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1749
  • Rating: +60/-3
    • View Profile
Re: Pacman Nspire
« Reply #63 on: August 26, 2011, 12:02:25 am »
Do you draw them with geometric primitives?

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: Pacman Nspire
« Reply #64 on: August 26, 2011, 04:09:27 am »
This trick only works with TI.Images.
Drawing simple stuff with rect and circle is much faster, so in your case I guess you are fine.

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Pacman Nspire
« Reply #65 on: August 26, 2011, 05:46:30 am »
Do you draw them with geometric primitives?

Yes lol he did :

Code: [Select]
function drawghosts(gc)
gc:setColorRGB(255,0,0)
gc:fillArc(gonex,goney,blockwidth,blockwidth,0,180)
gc:fillPolygon({gonex,goney+blockwidth/2,gonex,goney+blockwidth,gonex+.2*blockwidth,goney+.8*blockwidth,gonex+.4*blockwidth,goney+blockwidth,gonex+.45*blockwidth,goney+blockwidth,gonex+.45*blockwidth,goney+.8*blockwidth,gonex+.55*blockwidth,goney+.8*blockwidth,gonex+.55*blockwidth,goney+blockwidth,gonex+.6*blockwidth,goney+blockwidth,gonex+.8*blockwidth,goney+.8*blockwidth,gonex+blockwidth,goney+blockwidth,gonex+blockwidth,goney+.5*blockwidth,gonex,goney+.5*blockwidth})
gc:setColorRGB(255,255,255)
gc:fillArc(gonex+.25*blockwidth,goney+.25*blockwidth,.25*blockwidth,.35*blockwidth,0,360)
gc:fillArc(gonex+.6*blockwidth,goney+.25*blockwidth,.25*blockwidth,.35*blockwidth,0,360)
gc:setColorRGB(0,0,255)
gc:fillArc(gonex+.38*blockwidth,goney+.35*blockwidth,.1*blockwidth,.15*blockwidth,0,360)
gc:fillArc(gonex+.75*blockwidth,goney+.35*blockwidth,.1*blockwidth,.15*blockwidth,0,360)
gc:setColorRGB(0,255,255)
gc:fillArc(gtwox,gtwoy,blockwidth,blockwidth,0,180)
gc:fillPolygon({gtwox,gtwoy+blockwidth/2,gtwox,gtwoy+blockwidth,gtwox+.2*blockwidth,gtwoy+.8*blockwidth,gtwox+.4*blockwidth,gtwoy+blockwidth,gtwox+.45*blockwidth,gtwoy+blockwidth,gtwox+.45*blockwidth,gtwoy+.8*blockwidth,gtwox+.55*blockwidth,gtwoy+.8*blockwidth,gtwox+.55*blockwidth,gtwoy+blockwidth,gtwox+.6*blockwidth,gtwoy+blockwidth,gtwox+.8*blockwidth,gtwoy+.8*blockwidth,gtwox+blockwidth,gtwoy+blockwidth,gtwox+blockwidth,gtwoy+.5*blockwidth,gtwox,gtwoy+.5*blockwidth})
gc:setColorRGB(255,255,255)
gc:fillArc(gtwox+.25*blockwidth,gtwoy+.25*blockwidth,.25*blockwidth,.35*blockwidth,0,360)
gc:fillArc(gtwox+.6*blockwidth,gtwoy+.25*blockwidth,.25*blockwidth,.35*blockwidth,0,360)
gc:setColorRGB(0,0,255)
gc:fillArc(gtwox+.38*blockwidth,gtwoy+.35*blockwidth,.1*blockwidth,.15*blockwidth,0,360)
gc:fillArc(gtwox+.75*blockwidth,gtwoy+.35*blockwidth,.1*blockwidth,.15*blockwidth,0,360)
gc:setColorRGB(255,128,255)
gc:fillArc(gthreex,gthreey,blockwidth,blockwidth,0,180)
gc:fillPolygon({gthreex,gthreey+blockwidth/2,gthreex,gthreey+blockwidth,gthreex+.2*blockwidth,gthreey+.8*blockwidth,gthreex+.4*blockwidth,gthreey+blockwidth,gthreex+.45*blockwidth,gthreey+blockwidth,gthreex+.45*blockwidth,gthreey+.8*blockwidth,gthreex+.55*blockwidth,gthreey+.8*blockwidth,gthreex+.55*blockwidth,gthreey+blockwidth,gthreex+.6*blockwidth,gthreey+blockwidth,gthreex+.8*blockwidth,gthreey+.8*blockwidth,gthreex+blockwidth,gthreey+blockwidth,gthreex+blockwidth,gthreey+.5*blockwidth,gthreex,gthreey+.5*blockwidth})
gc:setColorRGB(255,255,255)
gc:fillArc(gthreex+.25*blockwidth,gthreey+.25*blockwidth,.25*blockwidth,.35*blockwidth,0,360)
gc:fillArc(gthreex+.6*blockwidth,gthreey+.25*blockwidth,.25*blockwidth,.35*blockwidth,0,360)
gc:setColorRGB(0,0,255)
gc:fillArc(gthreex+.38*blockwidth,gthreey+.35*blockwidth,.1*blockwidth,.15*blockwidth,0,360)
gc:fillArc(gthreex+.75*blockwidth,gthreey+.35*blockwidth,.1*blockwidth,.15*blockwidth,0,360)
end

However, looking at what the final shape of the ghost looks like, I think I would have done the drawing differently :
 - draw the top semi-circle
 - draw a square under it, for the bottom part,
 - draw white triangles at the very bottom

 ^ that's all
« Last Edit: August 26, 2011, 05:49:31 am by adriweb »
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

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: Pacman Nspire
« Reply #66 on: August 26, 2011, 10:51:14 pm »
Ah right that's what I guessed he did. Personally I would be tempted to use sprites, since I would be able to put more details in them, such as SNES-like graphics.

Offline Adriweb

  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1708
  • Rating: +229/-17
    • View Profile
    • TI-Planet.org
Re: Pacman Nspire
« Reply #67 on: August 27, 2011, 05:24:17 am »
Sprites are obviously better but TI's image format s*cks *ss. And for now, it's slow...
My calculator programs
TI-Planet.org co-admin.
TI-Nspire Lua programming : Tutorials  |  API Documentation

Offline Levak

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1002
  • Rating: +208/-39
    • View Profile
    • My website
Re: Pacman Nspire
« Reply #68 on: August 27, 2011, 12:44:46 pm »
+1, look at my Nyan Cat game, sprites blink as it is slow...
I do not get mad at people, I just want them to learn the way I learnt.
My website - TI-Planet - iNspired-Lua

Offline pianoman

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 426
  • Rating: +24/-0
  • ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫ ♪♫
    • View Profile
Re: Pacman Nspire
« Reply #69 on: August 27, 2011, 02:27:01 pm »

However, looking at what the final shape of the ghost looks like, I think I would have done the drawing differently :
 - draw the top semi-circle
 - draw a square under it, for the bottom part,
 - draw white triangles at the very bottom

 ^ that's all
Hmmm, that's interesting... I'll try that. :)
And yeah, I'd love to use sprites, but that would make it unbearably slow D:

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: Pacman Nspire
« Reply #70 on: August 27, 2011, 02:29:07 pm »

However, looking at what the final shape of the ghost looks like, I think I would have done the drawing differently :
 - draw the top semi-circle
 - draw a square under it, for the bottom part,
 - draw white triangles at the very bottom

 ^ that's all
+the eyes :)
« Last Edit: August 27, 2011, 02:29:20 pm by Hayleia »
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Jonius7

  • python! Lua!
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1918
  • Rating: +82/-18
  • Still bringing new dimensions to the TI-nspire...
    • View Profile
    • TI Stadium
Re: Pacman Nspire
« Reply #71 on: August 04, 2013, 10:37:44 am »
Hmm this is an inactive topic, but thing is the Monopoly nspire userbar on pianoman's sig, led me to this very topic. Bit misleading.

I have seen a pacman lua, though some elements of that particular pacman game could have been improved.
Programmed some CASIO Basic in the past
DJ Omnimaga Music Discographist ;)
DJ Omnimaga Discography
My Own Music!
My Released Projects (Updated 2015/05/08)
TI-nspire BASIC
TI-nspire Hold 'em
Health Bar
Scissors Paper Rock
TI-nspire Lua
Numstrat
TI-nspire Hold 'em Lua
Transport Chooser
Secret Project (at v0.08.2 - 2015/05/08)
Spoiler For Extra To-Be-Sorted Clutter:

Spoiler For Relegated Projects:
TI-nspire BASIC
Battle of 16s (stalled) | sTIck RPG (stalled) | Monopoly (stalled) | Cosmic Legions (stalled)
Axe Parser
Doodle God (stalled while I go and learn some Axe)