Player = class
constructor = function()
this.sprite = Quick.addSprite("bobhover",0,0,16,24)
this.progressbar = new bar( 1000, 100, "bar2")
end
state = function( mode )
if this.sprite.name == "bobhover" and mode then
this.sprite.name = "bobfly"
else
if not mode and this.sprite.name == "bobfly" then
this.sprite.name = "bobhover"
end
end
if mode then
Quick.camera.shake = 0.7
this.sprite.ay = 450
else
Quick.camera.shake = 0.00
end
end
draw = function()
this.progressbar.progress = random.nextInt( 1000 )
this.progressbar.updateBar()
this.progressbar.drawBar( 0, 50, 50 * Quick.camera.zoom, 5 * Quick.camera.zoom, system.time()/60%360 )
end
end
init = function()
LevelDev = 0
Quick.init()
Quick.ground = -50000000
Quick.gravity = 25
Quick.camera.zoom = 3
Quick.friction = 5
control_help = Quick.addText("Use LEFT or RIGHT arrows to move",0,-30,5,5)
control_help_2 = Quick.addText("Use UP arrow to use the jetpack",0,-39,5,5)
help = Quick.addText("< < < Keep going",40,150,5,5)
arrow = Quick.addText("> > >",20,-49,5,5)
arrow_2 = Quick.addText("^",85,-50,20,20)
arrow_2 = Quick.addText("^",85,-35,20,20)
arrow_2 = Quick.addText("^",85,-20,20,20)
arrow_2 = Quick.addText("^",85,100,20,20)
arrow_2 = Quick.addText("^",85,85,20,20)
arrow_2 = Quick.addText("^",85,70,20,20)
lvl_1 = Quick.addMap("map",0,150,500,500)
endlevel = Quick.addSprite("end",-144,170,25,60)
endlevel.fixed = 1
endlevel.solid = 0
//lvl2
//lvl_2 = Quick.addMap("map2",500,150,500,500)
coin = endlevel = Quick.addSprite("coin",272,33,25,25)
player = new Player()
end
update = function()
//in init set LevelDev to 1 when making levels
//when not making levels or in dev set to 0
if LevelDev == 1 then
if keyboard.S then
lvl_1.solid = 0
lvl_2.solid = 0
end
if keyboard.D then
lvl_1.solid = 1
lvl_2.solid = 1
end
end
// other stuff
if keyboard.R then
player.sprite.y = 0
player.sprite.x = 0
end
if keyboard.LEFT then
player.sprite.hflip = 1
player.sprite.vx -= 5
end
if keyboard.RIGHT then
player.sprite.hflip = 0
player.sprite.vx += 5
end
if Quick.spriteCollision(endlevel,player.sprite) then
print("end")
player.sprite.x = 0
player.sprite.y = 0
else
print(round(player.sprite.y)+" y, "+ round(player.sprite.x)+" x")
end
player.state( keyboard.UP )
Quick.camera.move( player.sprite.x, player.sprite.y )
Quick.update()
end
draw = function()
Quick.draw()
player.draw()
CRT(1000, 0.5,5)
//CRT(no of lines,intensity,speed)
end
You need to have a sprite with 3 frames of animation.
Copy from the library example if you don't have such sprites.
I think it would be good to modify Quick Engine so that, for example, complex objects would be rendered according to the draw method they would have.