Not a member of Pastebin yet?
                        Sign Up,
                        it unlocks many cool features!                    
                - gamescene = gideros.class(Sprite)
 - function gamescene:init()
 - Level = TiledAsWorldEditor.new("level.lua")
 - self:addChild(Level)
 - TiledAsWorldEditor:EnableDebugDrawing(world)
 - self.lander = self:lander(400, 100)
 - end
 - function gamescene:lander(x, y)
 - local lander1 = Bitmap.new(Texture.new("images/lander.png"))
 - local lander2 = Bitmap.new(Texture.new("images/lander2.png"))
 - local lander3 = Bitmap.new(Texture.new("images/lander3.png"))
 - lander1:setAnchorPoint(0.5, 0.5)
 - lander2:setAnchorPoint(0.5, 0.5)
 - lander3:setAnchorPoint(0.5, 0.5)
 - local lander = MovieClip.new{
 - {1, 1, lander1},
 - {2, 4, lander2},
 - {5, 7, lander3},
 - }
 - lander:setGotoAction(7, 2)
 - function lander:switchAnimation()
 - if stopped == true then
 - self:gotoAndPlay(2)
 - stopped = false
 - end
 - end
 - function lander:switchAnimation2()
 - self:gotoAndStop(1)
 - stopped = true
 - end
 - lander:setPosition(x,y)
 - local body = self.world:createBody{type = b2.DYNAMIC_BODY}
 - body:setPosition(lander:getX(), lander:getY())
 - body:setAngle(lander:getRotation() * math.pi/180)
 - body:setLinearVelocity(0, 0)
 - local polygon = b2.PolygonShape.new()
 - polygon:set(0, -22, 16, 10, -16, 10)
 - local fixture = body:createFixture{shape = polygon, density = 1.0,
 - friction = 0.6, restitution = 0.01}
 - lander.body = body
 - lander.body.type = "lander"
 - self:addChild(lander)
 - return lander
 - end
 
Advertisement
 
                    Add Comment                
                
                        Please, Sign In to add comment