Tangrams Activity

41 views
Skip to first unread message

Jeff V

unread,
Mar 29, 2012, 9:31:49 PM3/29/12
to tins...@googlegroups.com
OK, this Lua programming can be addictive. I hope nobody minds me using this Google Group to share.
 
 I created the following file with the Tangram pieces. I am pretty happy with the movement of the pieces (although criticism welcome). Now I need some help from the Lua experts out there. I want to create a template outline that the students must drag the pieces into. When they get it correct, the pieces will snap into place and indicate success. Then it would move on to another template. I am looking for suggestions on the best way to check if the pieces are in the correct place without having to necessarily check every vertex.
 
Small aside, it seemed like I used a semester of Algebra 2 in making this. I used 2x2 matrix tranformation and systems of linear inequalities.
 

 
Tangram v1.lua
Tangrams.tns

Steve Arnold

unread,
Mar 29, 2012, 10:06:35 PM3/29/12
to tins...@googlegroups.com
LOVE IT - thanks Jeff. I am so going to study your code.

Steve


--
To post to this group, send email to tins...@googlegroups.com
To unsubscribe send email to tinspire+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com.au/group/tinspire?hl=en-GB?hl=en-GB
The tns documents shared by group members are archived at
https://sites.google.com/site/tinspiregroup/classroom-news/welcome-abouttime
<Tangram v1.lua><Tangrams.tns>

With best wishes,
Steve
_________________
Dr Stephen Arnold
Educational Technology Consultant
Compass Learning Technologies

T3 Fellow, Teachers Teaching with Technology Australia

Office: +61-2-4237-6314
Mobile: +61-4-0175-3834
US cell: +1 (508) 869 4350
UK cell: +44 79 2425 1196
Web: http://compasstech.com.au
_________________

Travis Bower

unread,
Mar 30, 2012, 12:01:34 AM3/30/12
to tins...@googlegroups.com
Jeff,
fyi Steve did some tangram work with non-lua.....see the bottom of this link
Maybe you have already seen it, but just in case.

Jeff V

unread,
Apr 6, 2012, 8:22:57 PM4/6/12
to tins...@googlegroups.com
I have made some major enhancements. There are multiple puzzles which are accessed through the menu. I also believe the changes I made to the controls make it work pretty well on the handheld. I tried it with kids, and it worked pretty well. Please give me feedback if you try it. I will post the file here with the lua file, but future versions I will put on the Google Group Website (https://sites.google.com/site/tinspiregroup/ti-nspire-script-application-files).
 

Tangrams v3.0.tns
Tangram v3.lua

Marc Garneau

unread,
Apr 6, 2012, 9:42:42 PM4/6/12
to tins...@googlegroups.com
It's looking really good, Jeff.  Nice!

There's a bit of a bug with pressing the escape key when the menu isn't active (because Box is nil then).  
Putting in a condition seems to fix the problem I think:

function on.escapeKey()
if Box ~= nil then
Box:move(0, 0)
Box:resize(1, 1)
Box = nil
end
if TrackedObject ~= nil then
TrackedObject.selected = false
end
TrackedObject = nil
cursor.set("default")
platform.window:invalidate()
end


Marc Garneau


--
To post to this group, send email to tins...@googlegroups.com
To unsubscribe send email to tinspire+u...@googlegroups.com
For more options, visit this group at
http://groups.google.com.au/group/tinspire?hl=en-GB?hl=en-GB
The tns documents shared by group members are archived at
https://sites.google.com/site/tinspiregroup/classroom-news/welcome-abouttime
<Tangrams v3.0.tns><Tangram v3.lua>

Jeff V

unread,
Apr 7, 2012, 8:22:55 AM4/7/12
to tins...@googlegroups.com
Thanks Marc. I will make that change and repost on the Google Group website.
 
For those with more programming experience than me, I also was hoping there was a way to fix one other issue. The cursor goes away when a piece is flipped or rotated. If you "wake" the cursor up it comes back, but it is not as smooth as I had hoped. It was the only thing my kids sometimes got frustrated with.
 
Thanks,
Jeff

Andy Kemp

unread,
Apr 7, 2012, 9:57:54 AM4/7/12
to tins...@googlegroups.com
Try making use of the cursor.show() function to force the cursor on to the screen…

Cheers
Andy

--

Jeff V

unread,
Apr 10, 2012, 10:10:31 PM4/10/12
to tins...@googlegroups.com
Thanks Andy. I tried the cursor.show(). It seems to have helped, but not totally solved the problem. I tried it in some different places, maybe I am missing the correct place for it. I will keep trying. included file below. Anyone that has time and can help, I really appreciate it. This one problem is a bit frustrating.

Jeff

On Saturday, April 7, 2012 9:57:54 AM UTC-4, Andy Kemp wrote:
Try making use of the cursor.show() function to force the cursor on to the screen…e

Cheers
Andy

To unsubscribe send email to tinspire+unsubscribe@googlegroups.com
Tangram v3.lua

Marc Garneau

unread,
Apr 11, 2012, 1:43:37 AM4/11/12
to tins...@googlegroups.com
Hi Jeff,

Yes, the handheld can be frustrating, especially when you get things working on the software and there doesn't appear to be any logical reason why something happens (or doesn't happen) on the handheld.

Here's a trick that I picked up from Steve Arnold's tutorials to force the handheld screen to refresh.  I tried it with your script and it works as hoped.
--This sets up a screen refresh to occur 5 times per second (needed for the handheld). 

function on.timer() 
platform.window:invalidate() 
end 

function on.create() 
timer.start(1/5) 
end

I heard that on.create will be getting removed in the next version, so an alternative that still works is to put the timer.start(1/5) line into your on.paint function.

Marc

To unsubscribe send email to tinspire+u...@googlegroups.com

For more options, visit this group at
http://groups.google.com.au/group/tinspire?hl=en-GB?hl=en-GB
The tns documents shared by group members are archived at
https://sites.google.com/site/tinspiregroup/classroom-news/welcome-abouttime
<Tangram v3.lua>

John Hanna

unread,
Apr 11, 2012, 7:30:46 AM4/11/12
to tins...@googlegroups.com

I found using cursor.show() in the onEscape event works well as you use the esc key to release a grabbed object. The cursor will appear but will disappear in about 5 seconds.

 

     John Hanna

     jeh...@optonline.net

     www.johnhanna.us

     T3 - Teachers Teaching with Technology

     "the future isn't what it used to be."

 


To unsubscribe send email to tinspire+u...@googlegroups.com

Reply all
Reply to author
Forward
0 new messages