This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Test | |
-- Use this function to perform your initial setup | |
function setup() | |
print("Hello World!") | |
end | |
-- This function gets called once every frame | |
function draw() | |
-- This sets a dark background color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setup() | |
--first the rectangle | |
rect_width=100 --size of rectangle | |
rect_height=50 | |
--now create the physics object, we feed it the location | |
--of the four corners, relative to the centre of the | |
--rectangle, which is why all the measurements below | |
--are for half the height or width |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setup() | |
--first the rectangle | |
rect_width=100 --size of rectangle | |
rect_height=50 | |
--now create the physics object, we feed it the location | |
--of the four corners, relative to the centre of the | |
--rectangle, which is why all the measurements below | |
--are for half the height or width |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--# Main | |
-- class | |
-- Use this function to perform your initial setup | |
function setup() | |
b={} | |
for i=1,5 do | |
b[i]=Ball() | |
end | |
r={} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setup() | |
parameter.action('Run_without_coroutine',bigJob) | |
parameter.action('Run_with_coroutine',WithCoroutine) | |
end | |
function WithCoroutine() | |
cos=coroutine.create(bigJobCos) | |
coroutine.resume(cos) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Use this function to perform your initial setup | |
function setup() | |
print("Please wait while I load the images from the internet") | |
http.request("https://img1.minebook.me/gallery/48755_mordor.png", | |
function(i,a,b) mordor=i print("loaded") end) | |
http.request("http://www.portent.com/images/2012/04/nazgul-cyclery-logo-long.png", | |
function(i,a,b) nazgul=i print("loaded") end) | |
state="LOADING" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- test | |
-- Use this function to perform your initial setup | |
function setup() | |
if backup then Backup("pinch") end | |
img=readImage("Small World:Mine Medium") | |
p=pinch() | |
end | |
function draw() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function setup() | |
--set up normal sprite | |
img=readImage("Tyrian Remastered:Space Ice 3") | |
w,h=img.width,img.height | |
--set up mesh alternative | |
g=mesh() | |
g.texture="Tyrian Remastered:Flame 2" --name of the image we want to use | |
parameter.boolean("Mesh",false) | |
parameter.integer("NumberOfObjects",50,200,50) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ | |
This demo is where it starts to get more complicated, even though we'll only create | |
a 3D block with just 8 triangles. There are several parts to this | |
1. creating 3D objects | |
2. placing them in 3D space | |
3. choosing our viewpoint in 3D space | |
CREATING THE BLOCK | |
I've put the code that creates the block in its own class underneath, so you can use it easily | |
in your own projects. (Trust me, you will never want to write this code yourself. It took me |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--# Main | |
--[[ | |
In this demo, I've added a texture from the internet to make the dice more interesting | |
I've also added a fake highlight to the dice spots to give them some depth | |
--]] | |
OlderNewer