humm
mal gucken
EDIT:
nee, bei meiner neueren version stehts in der while true do schleife...
-- farben --
green = Color.new(0, 255, 0)
darkgreen = Color.new(0,128,0)
yellow = Color.new(255,255, 0)
red = Color.new(255, 0, 0)
blue = Color.new(0, 0, 255)
lightblue = Color.new(0, 0,128)
purple = Color.new(200, 0, 128)
black = Color.new(0, 0, 0)
gray = Color.new(128,128,128)
lightgray = Color.new(200,200,200)
white = Color.new(255,255,255)
-- pictures --
level = Image.load("images/level.png")
cursor = Image.load("images/cursor.png")
figure = Image.load("images/figure1.png")
-- fonts --
-- sound --
-- anderes --
cursor_x = 50
cursor_y = 50
speed = 2
a = 0
b = 0
c = 0
i = 0
o = 1
cg1 = 1
oldpad = Controls.read()
-- einheiten --
pos = {}
for i=1,20 do
pos[i] = {}
pos[i].x = 0
pos[i].y = 0
pos[i].s = 0.5
end
while true do
pad = Controls.read()
screen:clear()
screenrint(200, 8, "Wadabasaga!", gray)
screen:blit(0,0,level)
screen:blit(cursor_x,cursor_y,cursor,true)
-- steuerung --
if pad:left() then
cursor_x = cursor_x - speed
end
if pad:right() then
cursor_x = cursor_x + speed
end
if pad:up() then
cursor_y = cursor_y - speed
end
if padown() then
cursor_y = cursor_y + speed
end
if pad:cross() and oldpad:cross() ~= pad:cross() and cg1 <= 20 then
pos[cg1].y = cursor_y
pos[cg1].x = cursor_x
cg1 = cg1 + 1
end
i=1
while i<cg1 do
screen:blit(pos[i].x,pos[i].y,figure,true)
i=i+1
end
-- schwerkraft
if cg1 > 1 then
pos[i].gravity = screenixel(pos[i].x+16,pos[i].y-33)
if pos[i].gravity:color(darkgreen) then
pos[i].y = pos[i].y
else
pos[i].y = pos[i].y - 1
repeat pos[i].y = pos[i].y - 1 until pos[i].gravity:color = pos[i].gravity:color(darkgreen)
end
end
screenrint(200,260,"i:"..i.." "..cg1.."",lightgray)
-- ränder --
if cursor_x < 0 then
cursor_x = 0
end
if cursor_x > 464 then
cursor_x = 464
end
if cursor_y < 0 then
cursor_y = 0
end
if cursor_y > 256 then
cursor_y = 256
end
--wichtig--
oldpad = pad
screen.flip()
screen.waitVblankStart()
end