Skip to content

Commit

Permalink
Updating the test script to the new script architecture
Browse files Browse the repository at this point in the history
  • Loading branch information
ZILtoid1991 committed Dec 12, 2023
1 parent 38f396d commit 2f6c5b5
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions assets/test4.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,15 @@ Globalstate = 0
MoveX = 1
MoveY = 1

--Script entry point
function Main(luastate)
Globalstate = luastate
local sprtLayer = getLayer(16)
local dlangman = getBitmapResource("dlangman")
addSprite(sprtLayer, dlangman, 0, 0, 0, 0, 0, 255, 1024, 1024)
--timer_register(Globalstate, 20, "UpdateFunc")
return 0
--Script initialization
function Initialize()
addSprite(16, "dlangman", 0, 0, 0, 0, 255, 1024, 1024)
end
--Make D man bounce on the screen
function UpdateFunc()
local sprtLayer = getLayer(16)
relMoveSprite(sprtLayer, 0, MoveX, MoveY)
local spritePos = getSpriteCoordinate(sprtLayer, 0)
relMoveSprite(16, 0, MoveX, MoveY)
local spritePos = getSpriteCoordinate(16, 0)
--test sprite if it touched the edges
if spritePos.left <= 0 then
MoveX = 1
end
Expand Down

0 comments on commit 2f6c5b5

Please sign in to comment.