-- mkay1
-- Use this function to perform your initial setup
function setup()
print("Hello World!")
print(WIDTH/2,HEIGHT/2)
--player variables
playerx = 20
playery = 384 + 46
-- cloud variables
cloudx = 128
cloudy = 600
-- cloud 2 variables
cloudx2 = 348
cloudy2 = 648
-- cloud 3 variables
cloudx3 = 600
cloudy3 = 549
--cloud 4 variables
cloudx4 = -156
cloudy4 = 560
--cloud 5 variables
cloudx5 = -457
cloudy5 = 643
end
function draw()
--function loading
cloudif()
cloud_movement()
background(0, 142, 255, 255)
fill(124, 255, 0, 255)
rect(0,0,749,384)
--cloud drawing
sprite("Platformer Art:Cloud 1",cloudx,cloudy)
sprite("Platformer Art:Cloud 2",cloudx2,cloudy2)
sprite("Platformer Art:Cloud 3",cloudx3,cloudy3)
sprite("Platformer Art:Cloud 2",cloudx4,cloudy4)
sprite("Platformer Art:Cloud 1",cloudx5,cloudy5)
--player drawing
sprite("Platformer Art:Guy Standing",playerx,playery)
end
function touched(touch)
if touch.x > WIDTH/2 then
playerx = playerx + 200 * DeltaTime
else playerx = playerx -200 * DeltaTime
end
end
function cloud_movement()
cloudx = cloudx + 1.3
cloudx2 = cloudx2 + 1.2
cloudx3 = cloudx3 + 1.2
cloudx4 = cloudx4 + 1.4
cloudx5 = cloudx5 + 1.4
end
function cloudif()
if cloudx - 132 > 749 then
cloudx = 0 - 132
end
if cloudx2 - 132 > 749 then
cloudx2 = 0 - 132
end
if cloudx3 - 132 > 749 then
cloudx3 = 0 -132
end
if cloudx4 - 132 > 749 then
cloudx4 = 0 - 132
end
if cloudx5 - 132 > 749 then
cloudx4 = 0 - 132
end
end
Hello,
I have been active on codea again unfortunatly i have a ipad 1 so i cant use the 2.0 version.
Aside from that i would like some feedback of this code because i kinda want to know how to make the player movement smoother and make the code smaller without getting stuff out of this little program.
Greetings mkay