View difference between Paste ID: SD6NX3TL and GmtNcaWS
SHOW: | | - or go back to the newest paste.
1
local mydata = require("mydata")
2-
local humanoid
2+
3
mydata.humanoids = {}
4
local scrollSpeedX = 0
5
6
7
function createHumanoid(layer)
8
9
    local layer = layer or display.currentStage
10
11
    for i = 1, 10 do
12
13
        local humanoid = display.newRect(0, 0, 10, 10)
14-
        humanoid = display.newRect(0, 0, 10, 10)
14+
15
        humanoid.y = 260
16
        physics.addBody(humanoid, { isSensor = true })
17
        mydata.humanoids[#mydata.humanoids + 1] = humanoid
18
    end
19
20
    function updateHumanoid()
21
22
        if switchTerrain == 0 then
23
24
            if player.x <= 100 then scrollSpeedX = 0
25
            else scrollSpeedX = -player.x / 70
26
            end
27
28
        elseif switchTerrain == 1 then
29
30-
            if humanoid.x
30+
31
32-
            then
32+
33
            end
34
	end
35
	for _, humanoid in ipairs(mydata.humanoids) do
36
            if humanoid.x then
37
                humanoid.x = humanoid.x + scrollSpeedX
38
            end
39
	end
40
    end
41
42
    Runtime:addEventListener("enterFrame", updateHumanoid)
43-
            if humanoid.x
43+