Omnimaga

Calculator Community => Other Calc-Related Projects and Ideas => TI-Nspire => Topic started by: Nick on November 14, 2011, 06:35:34 pm

Title: Balance game
Post by: Nick on November 14, 2011, 06:35:34 pm
Hye i started a new project recently and i wanna know what you think about it..

it's a balance game in which you have to balance the balance by making balls grow and then drop them on the balance

(http://img.removedfromgame.com/imgs/balance.jpg)
Title: Re: Balance game
Post by: Deep Toaster on November 14, 2011, 06:36:22 pm
Sounds like a great idea -- not many physics games out there, anyway. How far have you gotten?
Title: Re: Balance game
Post by: Nick on November 14, 2011, 06:37:42 pm
well, it's not that die hard physics :) just let it drop and balance it xp
i made the ball grow, but that's it
and by now i can move the balance with my arrows to check if this will work, and it works
Title: Re: Balance game
Post by: parserp on November 14, 2011, 06:37:50 pm
ooh sounds like a new and challenging type of game! I like!
I +1ed ;D
EDIT: what does "Niet opgeslagen" mean?
Title: Re: Balance game
Post by: Nick on November 14, 2011, 06:44:16 pm
that's dutch for "not saved".
it displays that if you paste the lua with scripting tools into the emulator and you dont save first
Title: Re: Balance game
Post by: parserp on November 14, 2011, 06:44:51 pm
ooh that's cool :D
Title: Re: Balance game
Post by: flyingfisch on November 14, 2011, 07:28:38 pm
I should try to make this for Casio Calculators
Title: Re: Balance game
Post by: Nick on November 14, 2011, 07:29:26 pm
go ahead.. i could send you the source when done so you can get the formulas for it
Title: Re: Balance game
Post by: flyingfisch on November 14, 2011, 07:32:05 pm
Oooooh, that would be great, thanks! In fact, there is lua for casio calcs so it should be an easy port. ;)
Title: Re: Balance game
Post by: Nick on November 14, 2011, 07:34:58 pm
serious? didn't know that.. ok, that'll be great :)
Title: Re: Balance game
Post by: Jim Bauwens on November 15, 2011, 01:01:00 pm
Can't wait to see what this will become :)
Title: Re: Balance game
Post by: Yeong on November 15, 2011, 01:01:39 pm
I would love to learn Lua but I rarely programs on computer D:
Title: Re: Balance game
Post by: Nick on November 15, 2011, 01:02:01 pm
me too, i don't even know if it will be fun.. but we'll see :) it's not that big, so i think it might be finished next week or so

@TBO_Yeong, try it, you can do a lot of stuff with lua, you really have to try it out, because otherwise you'll have to learn asm with ndless 3.0 to get real nice programs on the nspire, cause you don't have something like axe..
Title: Re: Balance game
Post by: Yeong on November 15, 2011, 01:16:57 pm
does LuaCS works well? because last time I tried it, it froze D:
Title: Re: Balance game
Post by: Nick on November 15, 2011, 01:19:57 pm
normally it functions well, maybe you should post the code so we could see it :)

and for balance, is it possible to make a table value out of a string e.g.
Code: [Select]
ball1 = {0,0,0}
ballnr = 1

tostring("ball"..ballnr)[1] = 5

this doesn't work, but maybe something like that (but i don't know what) works?
Title: Re: Balance game
Post by: Jim Bauwens on November 15, 2011, 02:10:13 pm
Do you mean convert a table to a string, or opposite?
To simple display a table number value, use this:
Code: [Select]
a={1,2,3}
nr=1
text=tostring(a[nr])

Edit:
I get it.
If the table is a global table, you can do this
Code: [Select]
ball1={1,2,3}
nr=1

thetable = _G["ball" .. nr][5]

_G is the global table.
Title: Re: Balance game
Post by: Adriweb on November 15, 2011, 02:14:18 pm
Instead of having to mess aroud with dynnamic variable names, I'd have put new balls in a Balls table, then assign an id to a ball, and call it by reading/writing like that :

Balls[ballID][1]

I did that kind of thing for my BreakOut game :

Code: [Select]
    aBall = Ball(math.random(10,platform.window:width()-10-XLimit),platform.window:height()-26,-1-speedDiff,-1-speedDiff,#BallsTable+1)
    table.insert(BallsTable,aBall)

Full source here. (https://github.com/adriweb/Nspire-BreakOut/blob/master/BreakOut.lua)
Title: Re: Balance game
Post by: Jim Bauwens on November 15, 2011, 02:18:18 pm
Yes, its better to keep a table with your balls in it, more flexible that way :)
/me smacks himself
Title: Re: Balance game
Post by: Nick on November 15, 2011, 02:23:12 pm
thanks both, but i'll use adriweb's way, it'll be easier xp

well in fact, that's the way i did it with tetris too, but with blocks, but i seem to have forgotten that xp
Title: Re: Balance game
Post by: Jim Bauwens on November 15, 2011, 02:25:16 pm
And better :)