This file contains hidden or 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
--Load Physics Library | |
local physics = require "physics" | |
--Show physics drawing lines, for help with debugging | |
physics.setDrawMode( "hybrid" ) | |
--Start Physics | |
physics.start() | |
This file contains hidden or 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
--Change the reference point of the object | |
myObject:setReferencePoint(display.BottomRightReferencePoint) | |
--This will add a buffer of half the objects width, if you want it flush with the | |
--right, change it to myObject.x=display.contentWidth | |
myObject.x=display.contentWidth - myObject.contentWidth/2 | |
--This will add a vertical buffer of half the object's height, if you want it flush with the | |
--bottom, change it to myobject.y=display.contentHeight |
This file contains hidden or 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
--Change the reference point of the object | |
myObject:setReferencePoint(display.BottomLeftReferencePoint) | |
--This will add a buffer of half the objects width, if you want it flush with the | |
--left, change it to myObject.x=0 | |
myObject.x=0 + myObject.contentWidth/2 | |
--This will add a vertical buffer of half the object's height, if you want it flush with the | |
--bottom, change it to myobject.y=display.contentHeight | |
myObject.y=display.contentHeight - myObject.contentHeight/2 |
This file contains hidden or 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 is a work in progress | |
--Create the first background | |
local myBackground=display.newImage("background1.png") | |
myBackground:setReferencePoint(display.CenterLeftReferencePoint) | |
myBackground.x=0 | |
--Create the second background | |
local myBackground2=display.newImage("background2.png") | |
myBackground2:setReferencePoint(display.CenterLeftReferencePoint) |
This file contains hidden or 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 adds the widget library to our project | |
local widget = require "widget" | |
--This is what is run when we press our button | |
local myButtonEvent = function (event ) | |
if event.phase == "release" then | |
print( "You pressed and released the "..event.target.id.." button!" ) | |
end | |
end |
NewerOlder