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
--Create a new AKtween | |
local tween = AKtween:newTween({time=5000, y=-600, ease='outQuad', | |
onComplete={time=5000, y=600, ease='inQuad'} | |
}) | |
--Sample result: | |
--tween = { | |
-- arr = { | |
-- "y" = {-4.79, ... 0, ... 4.79} | |
-- }, |
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
--Create a new AKtween | |
local tween = AKtween:newTween({time=5000, y=-600, ease='outQuad', | |
onComplete={time=5000, y=600, ease='inQuad'} | |
}) | |
--Append an existing AKtween | |
tween:append({time=10000, x=100, ease='outQuad'}) | |
--Sample result: | |
--tween = { |
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
--Create a new AKtween | |
local tween = AKtween:newTween({time=5000, y=-600, ease='outQuad', | |
onComplete={time=5000, y=600, ease='inQuad'} | |
}) | |
--Create a display object/ image/ sprite | |
local obj = display.newCircle(0,0,20) | |
--Apply tween to the object, with a tween name | |
tween:apply(obj, 'moveY') |
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
--Create and apply an AKtween | |
local tween = AKtween:newTween({...}) | |
local obj = display.newCircle(0,0,20) | |
tween:apply(obj, 'moveY') | |
--Play tween | |
obj:playTween('moveY') |
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
--Create and apply an AKtween | |
local tween = AKtween:newTween({...}) | |
local obj = display.newCircle(0,0,20) | |
tween:apply(obj, 'tweenName') | |
--Play tween | |
obj:playTween('tweenName') | |
--End tween | |
obj:finishTween() |
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
--Enemy.lua | |
local scene = scene | |
local Enemy = {Instances={}}; scene.Enemy = Enemy | |
--STATIC CLASS FUNCTIONS (self refers to Enemy, not enemy) | |
function Enemy:New() | |
--creates an enemy instance | |
local enemy = display.newImage('image_name') |
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
--Mouse.lua | |
local scene = scene | |
local Mouse = {Instances={}} | |
--MOUSE CLASS METHODS (FIRST LETTER IS CAPITOLIZED) | |
Mouse.Get = scene.Get | |
Mouse.Show = scene.Show | |
Mouse.Dispose = scene.Dispose |
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
--Cat.lua | |
local scene = scene | |
local Cat = {Instances={}} | |
--CAT CLASS METHODS (FIRST LETTER IS CAPITOLIZED) | |
Cat.Get = scene.Get | |
Cat.Show = scene.Show | |
Cat.Dispose = scene.Dispose |
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
--main.lua | |
local storyboard = require('storyboard') | |
storyboard.gotoScene('SceneGame') | |
--SceneGame.lua | |
local Game = storyboard.newScene() | |
Game:addEventListener('createScene', Game) | |
function Game:createScene() | |
scene = self.view | |
local scene = scene |
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
--Hud.lua | |
scene:addEventListener('onEnemyKill', Hud) | |
function Hud:onEnemyKill(event) | |
local points = self.points + 20 | |
self.points = points | |
self:dispatchEvent({name='onEnemyKill', points=points}) --dispatch to Hud scope | |
end | |
--Score.lua | |
Hud:addEventListener('onEnemyKill', Score) --listen on Hud scope |
OlderNewer