Author Topic: [luaFX] Indy500  (Read 2835 times)

0 Members and 1 Guest are viewing this topic.

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
[luaFX] Indy500
« on: June 11, 2012, 11:15:59 am »
Hi all!

Working on my first game in LuaFX. So far all that happens is the ai cars try to avoid you.

Code: http://pastebin.com/5EWqXNzf

I am having trouble with the collisions detection right now... for some reason ai cars can "run over" you and you do not get the crash screen. The detection is done on line 231.


If people could test this program that would be great, so I have provided a *.lc for download:
Link



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0

Offline Nick

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1166
  • Rating: +161/-3
  • You just got omnom'd
    • View Profile
    • Nick Steen
Re: [luaFX] Indy500
« Reply #1 on: June 11, 2012, 12:39:49 pm »
hi

i didn't test it (i don't have any casio calc), but i think i found the reason of the crash bug.
it's explained in the image (i hope you understand it xp)



ok, i just saw a mistake in the image. the inequation signs have to be switched in the ai.x statements

in words: your ai.x value collides with the player.x value, so that's oogd
but for the y checking, you also have to iclude the height of the ai cars. in the ai.y<player.y+8 you have to change the ai.y to ai.y+ai.height <player.y+8
« Last Edit: June 11, 2012, 12:44:05 pm by Nick »

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: [luaFX] Indy500
« Reply #2 on: June 11, 2012, 03:28:31 pm »
I should make a program to run these programs on a TI-Nspire. Shouldn't be too hard.

Offline flyingfisch

  • I'm 1337 now!
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1620
  • Rating: +94/-17
  • Testing, testing, 1...2...3...4...5...6...7...8..9
    • View Profile
    • Top Page Website Design
Re: [luaFX] Indy500
« Reply #3 on: June 13, 2012, 10:37:35 am »
hi

i didn't test it (i don't have any casio calc), but i think i found the reason of the crash bug.
it's explained in the image (i hope you understand it xp)



ok, i just saw a mistake in the image. the inequation signs have to be switched in the ai.x statements

in words: your ai.x value collides with the player.x value, so that's oogd
but for the y checking, you also have to iclude the height of the ai cars. in the ai.y<player.y+8 you have to change the ai.y to ai.y+ai.height <player.y+8


Ah, I will try that and tell you what happens. :)



Quote from: my dad
"welcome to the world of computers, where everything seems to be based on random number generators"



The Game V. 2.0