Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - Frog

Pages: [1]
1
Lua / Physics engine 3.2
« on: June 29, 2012, 03:23:42 pm »
Hi everyone,

It's been some time since I last checked Omnimaga (although I've never been an active member), but now that I'm finished with my exams I finally have the time to program a calculator game again. And now I noticed that OS 3.2 has been released! I really want to try the Physics engine, because I'm thinking of making a game utilizing it, but I don't really know how to start.

I saw the video of the physics engine, but couldn't find the source code for it. Also, TI's documentation is pretty sparse. I assumed you didn't need to initialize the engine like you normally should, and I've been able to add a space, a body, and a shape. But how do I draw this? I guess you should somehow loop over all shapes and draw them in the positions the engine tells you to, but how do I do this? Or is there a better way? I can't find it in the reference...

On a side note: is using this physics engine overkill for a simple platforming game?

2
Lua / Toolpalette not working properly
« on: April 28, 2012, 03:57:56 pm »
Hi everyone. It's been some time since I last did something in Lua for the TI-NSpire, but I recently made a script for a school project. It basically uses the default NSpire graph window to draw shapes (circles, hyperbola's, etc.) by parameters. It works great. However, the toolpalette doesn't show when clicking the menu-key, unless you have first opened the calculator using the shortcut. This only happens on the calculator, not in the TI simulator. Really strange behavior, isn't it? I have the following code in my on.create function:

Code: [Select]
menu = {
{"Add",
{"Circle", showForm},
{"Ellipse", showForm},
{"Hyperbola", showForm},
{"Parabola", showForm}
}
}
toolpalette.register(menu)

Am I doing something wrong, or is it just a bug in the OS software?

Thanks!

3
Lua / Prettify string (superscript etc.)
« on: September 23, 2011, 02:02:15 pm »
I'm trying to prettify a string, so that for example ^2 becomes 2 and sqrt(x) becomes the true square root sign. How can I do this in Lua? I've been trying to find out the correct codes using string.byte(), but somehow superscript 1 to 3 all return 194. And when I try to insert that character using string.char(194) I get a lot of strange signs. How can I do this?

Thanks!

4
Lua / Add function to the gc class
« on: September 02, 2011, 11:25:19 am »
Hi everyone! I've been following this forum for quite some time now, but never actually posted something. I guess this is the first time: I've got a question...  :)

I'm trying to add methods and properties to the default gc class. I know that in "normal" lua you can just do something like this: function table.method(). So I tried the following:

Code: [Select]
function gc:method(x, y, width, height)
self:drawRect(x, y, width, height)
end

This didn't work though. I also tried to create a new class called screen that inherits from gc, but that didn't work either. Finally I tried "screen = gc:begin()", but that was no solution as well.

So my question is: how can I add my own method to the default gc class? Thanks! :)

Pages: [1]