{"id":263470,"date":"2015-08-13T12:49:02","date_gmt":"2015-08-13T08:49:02","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=263470"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=263470","title":{"rendered":"\u0414\u0435\u043b\u0430\u0435\u043c \u0438\u0433\u0440\u0443 \u0441 Gideros"},"content":{"rendered":"<p>             \u0414\u0430\u0432\u043d\u0435\u043d\u044c\u043a\u043e \u0431\u044b\u043b\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u043e <a href=\"http:\/\/habrahabr.ru\/post\/148311\/\">Gideros<\/a>, \u043d\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u044f \u044f \u0442\u0430\u043a \u0438 \u043d\u0435 \u043d\u0430\u0448\u0435\u043b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0434\u0435\u043b\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0441\u0442\u0430\u0442\u0435\u0439\u043a\u0443 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u044b \u043d\u0430 Gideros Studio. \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0438 \u0430\u043f\u043a\u0448\u043d\u0438\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d34\/644\/bf4\/d34644bf4df54efb9f2ceafee7dee3fb\"\/><br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h4>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/h4>\n<p>  \u0412\u0441\u0435 \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043f\u043e <a href=\"https:\/\/github.com\/gideros\/gideros\/releases\">\u044d\u0442\u043e\u0439 \u0441\u0441\u044b\u043b\u043a\u0435<\/a> \u0438 \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u0447\u043d\u0438\u043a. \u0412 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 Gideros 2015.08 \u0434\u043b\u044f OS X.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0430 \u043f\u0435\u0440\u0435\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 Application.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/879\/86c\/6f5\/87986c6f5a124efb997aa6a14af74d01\" alt=\"image\"\/><\/p>\n<p>  \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c Gideros Studio:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/5d4\/89d\/909\/5d489d909d4f4730a66bd1eb3c282499\" alt=\"image\"\/>  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u0439 \u044d\u043a\u0440\u0430\u043d<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/8c6\/9df\/305\/8c69df30575e4475917352fa0880b5e9\" alt=\"image\"\/>  <\/div>\n<\/div>\n<h4>\u0414\u0435\u043b\u0430\u0435\u043c \u043f\u0440\u043e\u0441\u0442\u0443\u044e \u0438\u0433\u0440\u0443<\/h4>\n<p>  \u041d\u0430\u0447\u043d\u0435\u043c \u043c\u044b \u0441 \u043a\u043b\u0430\u0441\u0441\u0438\u043a\u0438, \u043d\u0430\u043f\u0438\u0448\u0435\u043c \u00abHello, world!\u00bb \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435.<\/p>\n<p>  \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u043e\u0435\u043a\u0442:<\/p>\n<p>  1. \u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u00abCreate New Project\u00bb:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/20b\/5e3\/9e6\/20b5e39e670241f0bc224086ae70f35b\" alt=\"image\"\/><\/p>\n<p>  2. \u0412\u0432\u043e\u0434\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 (\u0432 \u043c\u043e\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u00abHi\u00bb):<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/da1\/b14\/9d9\/da1b149d93094594951bd68441a3aa12\" alt=\"image\"\/><\/p>\n<p>  3. \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0444\u0430\u0439\u043b \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/7d1\/db5\/e70\/7d1db5e70d414a94b330f195a8385dfd\" alt=\"image\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/baf\/211\/c02\/baf211c02582465c93cd143eb6d1b87e\" alt=\"image\"\/><\/p>\n<p>  \u041d\u0443 \u0438 \u043e\u0431\u0435\u0449\u0430\u043d\u043d\u044b\u0439 \u00abHello, world!\u00bb:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"lua\">-- application:getDeviceHeight() - \u0432\u044b\u0441\u043e\u0442\u0430 \u044d\u043a\u0440\u0430\u043d\u0430 -- application:getDeviceWidth() - \u0448\u0438\u0440\u0438\u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0430 -- textfield:getWidth() - \u0448\u0438\u0440\u0438\u043d\u0430 \u0441\u043f\u0440\u0430\u0439\u0442\u0430, \u0442.\u0435. \u0442\u0435\u043a\u0441\u0442\u0430 -- textfield:getHeight() - \u0432\u044b\u0441\u043e\u0442\u0430 \u0441\u043f\u0440\u0430\u0439\u0442\u0430, \u0442.\u0435. \u0442\u0435\u043a\u0441\u0442\u0430  local half_height = application:getDeviceHeight() \/ 2 local half_width = application:getDeviceWidth() \/ 2  local textfield = TextField.new(nil, &quot;Hello, world!&quot;)  textfield:setX(half_width - textfield:getWidth() \/ 2) textfield:setY(half_height - textfield:getHeight() \/ 2)  stage:addChild(textfield) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u0434\u0436\u043e\u0439\u0441\u0442\u0438\u043a \u0438 \u0443 \u043d\u0430\u0441 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f Gideros Player:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u0438\u043d\u044b<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d30\/17a\/88b\/d3017a88be064f4887a61ef83998da53\" alt=\"image\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/2e4\/19f\/f17\/2e419ff173614c858f2dc7a7b9e5c0ed\" alt=\"image\"\/>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043d\u0430 \u0441\u0438\u043d\u0438\u0439 \u0442\u0440\u0435\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a \u0438 \u0432 \u043f\u043b\u0435\u0435\u0440\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0448 \u0441\u043a\u0440\u0438\u043f\u0442.  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u0421\u043a\u0440\u0438\u043d\u044b<\/b><\/p>\n<div class=\"spoiler_text\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/ce6\/b50\/016\/ce6b50016be44d638908babb6443d2c5\" alt=\"image\"\/><\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/136\/0c8\/6a7\/1360c86a775f42318ebf232ba75a3fca\" alt=\"image\"\/>  <\/div>\n<\/div>\n<p>  \u0427\u0442\u043e\u0431\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0430\u0436\u043c\u0438\u0442\u0435 \u043d\u0430 \u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u0432\u043e\u0441\u044c\u043c\u0438\u0443\u0433\u043e\u043b\u044c\u043d\u0438\u043a. \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u0434\u0435\u043b\u0430\u0435\u043c \u0447\u0442\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u0435\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u043e\u0434\u043e\u0431\u0438\u0435 Angry Birds.<\/p>\n<h5>1. \u041f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0430:<\/h5>\n<p>  \u041d\u0430\u043c \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f SceneManager \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u0436\u0434\u0443 \u0443\u0440\u043e\u0432\u043d\u044f\u043c\u0438. \u0411\u0435\u0440\u0435\u043c \u0435\u0433\u043e <a href=\"https:\/\/github.com\/gideros\/Scene-Manager\">\u043e\u0442\u0441\u044e\u0434\u0430<\/a>, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0444\u0430\u0439\u043b\u044b <i>scenemanager.lua<\/i> \u0438 <i>easing.lua<\/i>. \u0417\u0430\u0433\u0440\u0443\u0436\u0430\u0435\u043c \u0438\u0445 \u0432 \u043d\u0430\u0448 \u043f\u0440\u043e\u0435\u043a\u0442 (\u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0441\u043a\u043e\u043f\u0438\u0440\u0443\u0439\u0442\u0435 \u0435\u0433\u043e \u0432 \u043f\u0430\u043f\u043a\u0443 \u043f\u0440\u043e\u0435\u043a\u0442\u0430) \u043f\u0440\u0438 \u043f\u043e\u043c\u043e\u0449\u0438 \u00abAdd Existing Files&#8230;\u00bb:<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/59b\/321\/f8e\/59b321f8e9e745739eb0ed69432dc249\"\/><\/p>\n<p>  \u0418 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043d\u0430\u0448\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0438\u0437 \u043f\u0430\u043f\u043a\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0435 \u043d\u0430\u043c \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f, \u043f\u0440\u043e\u0434\u0435\u043b\u0430\u0439\u0442\u0435 \u0442\u0443 \u0436\u0435 \u0441\u0430\u043c\u0443\u044e \u043f\u0440\u043e\u0446\u0435\u0434\u0443\u0440\u0443 \u043a\u0430\u043a \u0438 \u0441\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430\u043c\u0438. \u0411\u0435\u0440\u0435\u043c \u0438\u0445 \u043e\u0442\u0441\u044e\u0434\u0430:<br \/>  bg.png \u2014 <a href=\"https:\/\/yadi.sk\/i\/LLZpkzBliRDD9\">yadi.sk\/i\/LLZpkzBliRDD9<\/a><br \/>  buttons.png \u2014 <a href=\"https:\/\/yadi.sk\/i\/96GChQSAiRDCz\">yadi.sk\/i\/96GChQSAiRDCz<\/a><br \/>  props.png \u2014 <a href=\"https:\/\/yadi.sk\/i\/JaM6n6ZqiRDD7\">yadi.sk\/i\/JaM6n6ZqiRDD7<\/a><br \/>  spritesheet.png \u2014 <a href=\"https:\/\/yadi.sk\/i\/n6siot0LiRDHV\">yadi.sk\/i\/n6siot0LiRDHV<\/a><\/p>\n<h5>2. Just do it!<\/h5>\n<p>  \u0421\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 main.lua, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443 \u043d\u0430\u0441 \u0441\u043b\u0443\u0436\u0438\u0442 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0443\u0440\u043e\u0432\u043d\u044f:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"lua\">application:setOrientation(application.LANDSCAPE_LEFT)  sceneManager = SceneManager.new({ \t[&quot;level&quot;] = level })  stage:addChild(sceneManager)  --start level scene sceneManager:changeScene(&quot;level&quot;, 1, SceneManager.flipWithFade, easing.outBack) <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043d\u0430\u0448 \u0433\u043b\u0430\u0432\u043d\u044b\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u0441 \u0443\u0440\u043e\u0432\u043d\u0435\u043c level.lua:  <\/p>\n<div class=\"spoiler\"><b class=\"spoiler_title\">\u041a\u043e\u0434<\/b><\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"lua\">-- Add box2d physics library require &quot;box2d&quot;  level = Core.class(Sprite)  function level:init() \t \tapplication:setOrientation(Application.LANDSCAPE_LEFT)  \tlocal spritesheet = Texture.new(&quot;spritesheet.png&quot;) \tlocal props = Texture.new(&quot;props.png&quot;) \tlocal buttons = Texture.new(&quot;buttons.png&quot;) \t \tself.world = b2.World.new(0, 10, true) \t \t-- Globals for followed camera \tself.screenW = application:getContentWidth()*2 \tself.screenH = application:getContentHeight() \t \t-- Add sprites \tself.catapult_l = Bitmap.new(TextureRegion.new(spritesheet, 834, 1, 43, 124)) \tself.catapult_r = Bitmap.new(TextureRegion.new(spritesheet, 3, 1, 37, 199)) \tself.bird_idle = Bitmap.new(TextureRegion.new(spritesheet, 903, 798, 46, 44)) \tself.bg_image = Texture.new(&quot;bg.png&quot;, true, {wrap = Texture.REPEAT}) \tself.square_prop = Bitmap.new(TextureRegion.new(props, 0, 1, 84, 84)) \tself.triangle_prop = Bitmap.new(TextureRegion.new(props, 85, 1, 85, 83)) \tself.restart = Bitmap.new(TextureRegion.new(buttons, 580, 295, 108, 108)) \t \t-- Change scale of sprites \tself.bird_idle:setScale(0.6, 0.6, 0.6) \tsetHalf({self.catapult_r,  \t\tself.catapult_l, \t\tself.square_prop, \t\tself.triangle_prop, \t\tself.restart}) \t \t-- Create background \tlocal bg = Bitmap.new(self.bg_image) \tbg:setPosition(0, 0); \tlocal bg1 = Bitmap.new(self.bg_image) \tbg1:setPosition(bg:getWidth(), 0); \t \t-- Add ground collision \tself:wall(application:getContentWidth(), application:getContentHeight() - 20, application:getContentWidth()*2, 40) \t \t-- Add props physics \tlocal square_body = self.world:createBody{type = b2.DYNAMIC_BODY} \tlocal square_shape = b2.PolygonShape.new() \tsquare_shape:set(0, 0, \t\tself.square_prop:getWidth(), 0, \t\tself.square_prop:getWidth(), self.square_prop:getHeight(), \t\t0, self.square_prop:getHeight()) \tlocal square_fixture = square_body:createFixture{shape = square_shape, density = 1.0, friction = 0.1, restitution = 0.2} \tself.square_prop.body = square_body \t \tlocal triangle_body = self.world:createBody{type = b2.DYNAMIC_BODY} \tlocal triangle_shape = b2.PolygonShape.new() \ttriangle_shape:set(self.triangle_prop:getWidth() \/ 2, 0, \t\tself.triangle_prop:getWidth(), self.triangle_prop:getHeight(), \t\t0, self.triangle_prop:getHeight()) \tlocal triangle_fixture = triangle_body:createFixture{shape = triangle_shape, density = 1.0, friction = 0.1, restitution = 0.2} \tself.triangle_prop.body = triangle_body \t \t-- Place catapult \tself.catapult_r:setPosition(100, 178) \tself.catapult_l:setPosition(85, 174) \t \t-- Place bird \tself.bird_idle:setAnchorPoint(.5, .5) \tself.bird_idle:setPosition(100, 190) \tself.start_x, self.start_y = self.bird_idle:getPosition() \t \t-- Place props \tself.square_prop.body:setPosition(600, 200) \tself.triangle_prop.body:setPosition(600, 150) \t \t-- Place restart buttons \tself.restart:setAnchorPosition(0, 0) \tself.restart:setPosition(10, 10) \tself.restart:addEventListener(Event.MOUSE_DOWN, restartDown, self) \tself.restart:addEventListener(Event.MOUSE_UP, restartUp, self) \t \t-- Create elastic band for catapult \tlocal onBirdBandX = self.bird_idle:getX() - self.bird_idle:getWidth() \/ 2 \tlocal onBirdBandY = self.bird_idle:getHeight() \/ 2 \tself.band_l = Shape.new() \tself.band_l:setFillStyle(Shape.SOLID, 0x382E1C) \tself.band_l:beginPath(Shape.NON_ZERO) \tself.band_l:lineTo(onBirdBandX + 4, self.bird_idle:getY() - onBirdBandY + 5) \tself.band_l:lineTo(onBirdBandX + 4, self.bird_idle:getY() + onBirdBandY - 5) \tself.band_l:lineTo(87, 198) \tself.band_l:lineTo(85, 185) \tself.band_l:closePath() \tself.band_l:endPath()  \tself.band_r = Shape.new() \tself.band_r:setFillStyle(Shape.SOLID, 0x382E1C) \tself.band_r:beginPath(Shape.NON_ZERO) \tself.band_r:lineTo(onBirdBandX + 4, self.bird_idle:getY() - onBirdBandY + 5) \tself.band_r:lineTo(onBirdBandX + 4, self.bird_idle:getY() + onBirdBandY - 5) \tself.band_r:lineTo(110, 198) \tself.band_r:lineTo(110, 187) \tself.band_r:closePath() \tself.band_r:endPath()  \t-- Add drag events to bird \tself.bird_idle:addEventListener(Event.MOUSE_DOWN, onMouseDown, self) \tself.bird_idle:addEventListener(Event.MOUSE_MOVE, onMouseMove, self) \tself.bird_idle:addEventListener(Event.MOUSE_UP, onMouseUp, self)  \t-- Add all elements to scene \tself:addChildAt(bg, 1) \tself:addChildAt(bg1, 2) \tself:addChildAt(self.catapult_r, 3) \tself:addChildAt(self.band_r, 4) \tself:addChildAt(self.bird_idle, 5) \tself:addChildAt(self.catapult_l, 6) \tself:addChildAt(self.band_l, 7) \tself:addChildAt(self.square_prop, 8) \tself:addChildAt(self.triangle_prop, 9) \tself:addChildAt(self.restart, 10) \t \tself:addEventListener(Event.ENTER_FRAME, self.onEnterFrame, self)     self:addEventListener(&quot;exitBegin&quot;, self.onExitBegin, self) end   function level:wall(x, y, width, height) \tlocal wall = Shape.new() \twall:beginPath() \t \twall:moveTo(-width\/2,-height\/2) \twall:lineTo(width\/2, -height\/2) \twall:lineTo(width\/2, height\/2) \twall:lineTo(-width\/2, height\/2) \twall:closePath() \twall:endPath() \twall:setPosition(x,y) \t \tlocal body = self.world:createBody{type = b2.STATIC_BODY} \tbody:setPosition(wall:getX(), wall:getY()) \tbody:setAngle(wall:getRotation() * math.pi\/180) \tlocal poly = b2.PolygonShape.new() \tpoly:setAsBox(wall:getWidth()\/2, wall:getHeight()\/2) \tlocal fixture = body:createFixture{shape = poly, density = 1.0,  \tfriction = 1, restitution = 0} \twall.body = body \twall.body.type = &quot;wall&quot; \t \tstage:addChild(wall) end  function setHalf(arr) \tfor i = 1, #arr do \t\tarr[i]:setScale(.5, .5, .5) \tend end  function onMouseDown(self, event) \tlocal bird = self.bird_idle \tif bird:hitTestPoint(event.x, event.y) and bird.isFly ~= true then \t\tbird.isFocus = true  \t\tbird.x0, bird.y0 = event.x, event.y  \t\tevent:stopPropagation() \tend end  function onMouseMove(self, event) \t-- if sprite touch and move finger, then change position of sprite \tlocal bird = self.bird_idle \tif bird.isFocus then \t\tif event.x &gt; 20 and event.x &lt; 140 then \t\t\tlocal dx = event.x - bird.x0 \t\t\tbird:setX(bird:getX() + dx) \t\t\tbird.x0 = event.x \t\tend \t\t \t\tif event.y &gt; 160 and event.y &lt; 265 then \t\t\tlocal dy = event.y - bird.y0 \t\t\tbird:setY(bird:getY() + dy) \t\t\tself.bird_idle.y0 = event.y \t\tend \t\t \t\tlocal onBirdBandX = self.bird_idle:getX() - self.bird_idle:getWidth() \/ 2 \t\tlocal onBirdBandY = self.bird_idle:getHeight() \/ 2 \t\tself.band_l:clear() \t\tself.band_l = Shape.new() \t\tself.band_l:setFillStyle(Shape.SOLID, 0x382E1C) \t\tself.band_l:beginPath(Shape.NON_ZERO) \t\tself.band_l:lineTo(onBirdBandX + 4, self.bird_idle:getY() - onBirdBandY + 5) \t\tself.band_l:lineTo(onBirdBandX + 4, self.bird_idle:getY() + onBirdBandY - 5) \t\tself.band_l:lineTo(87, 198) \t\tself.band_l:lineTo(85, 185) \t\tself.band_l:closePath() \t\tself.band_l:endPath() \t\tself:addChild(self.band_l) \t \t\tself.band_r:clear() \t\tself.band_r = Shape.new() \t\tself.band_r:setFillStyle(Shape.SOLID, 0x382E1C) \t\tself.band_r:beginPath(Shape.NON_ZERO) \t\tself.band_r:lineTo(onBirdBandX + 4, self.bird_idle:getY() - onBirdBandY + 5) \t\tself.band_r:lineTo(onBirdBandX + 4, self.bird_idle:getY() + onBirdBandY - 5) \t\tself.band_r:lineTo(110, 198) \t\tself.band_r:lineTo(110, 187) \t\tself.band_r:closePath() \t\tself.band_r:endPath() \t\tself:addChildAt(self.band_r, 4) \t\t \t\tevent:stopPropagation() \tend end  function onMouseUp(self, event) \tif self.bird_idle.isFocus and self.bird_idle.isFly ~= true then \t\tself.bird_idle.isFocus = false  \t\tlocal bird_body = self.world:createBody{type = b2.DYNAMIC_BODY} \t\tlocal circle_shape = b2.CircleShape.new(0, 0, self.bird_idle:getWidth() \/ 2) \t\tlocal bird_fixture = bird_body:createFixture{shape = circle_shape, density = 1.0, friction = .5, restitution = 0} \t\t \t\tself.bird_idle.body = bird_body \t\tself.bird_idle.body:setPosition(self.bird_idle:getX() + self.bird_idle:getWidth() \/ 2, self.bird_idle:getY() + self.bird_idle:getHeight() \/ 2) \t\t \t\tself.bird_idle.body:applyForce((self.start_x - self.bird_idle:getX()) * 8, (self.start_y - self.bird_idle:getY()) * 8, self.bird_idle.body:getWorldCenter()) \t\t \t\tself.bird_idle.isFly = true \t\t \t\tself.band_l:clear() \t\tself.band_r:clear() \t\t \t\tevent:stopPropagation() \tend end  function restartDown (self, event) \tif self.restart:hitTestPoint(event.x, event.y) then \t\tself.touch = true \t\tevent:stopPropagation() \tend\t end  function restartUp (self, event) \tif self.touch then \t\tsceneManager:changeScene(&quot;level&quot;, 1, SceneManager.flipWithFade, easing.outBack) \tend end  function level:onEnterFrame()  \tself.world:step(1\/60, 8, 3) \t \tlocal screenW = application:getContentWidth() \tlocal screenH = application:getContentHeight() \t \tlocal offsetX = 0; \tlocal offsetY = 0; \t \tif((self.screenW - self.bird_idle:getX()) &lt; screenW\/2) then \t\toffsetX = -self.screenW + screenW  \telseif(self.bird_idle:getX() &gt;= screenW\/2) then \t\toffsetX = -(self.bird_idle:getX() - screenW\/2) \tend \t \tself:setX(offsetX) \t \tif((self.screenH - self.bird_idle:getY()) &lt; screenH\/2) then \t\toffsetY = -self.screenH + screenH  \telseif(self.bird_idle:getY()&gt;= screenH\/2) then \t\toffsetY = -(self.bird_idle:getY() - screenH\/2) \tend \t \tself:setY(offsetY) \t \t \tfor i = 1, self:getNumChildren() do \t\tlocal sprite = self:getChildAt(i) \t\tif sprite.body then \t\t\tlocal body = sprite.body \t\t\tlocal bodyX, bodyY = body:getPosition() \t\t\tsprite:setPosition(bodyX, bodyY) \t\t\tsprite:setRotation(body:getAngle() * 180 \/ math.pi) \t\tend \tend \t \t-- Move intarface with camera \tself.restart:setX(-self:getX()) \t \tif self.bird_idle:getX() &lt; 0 or self.bird_idle:getX() &gt; self.screenW then  \t\tsceneManager:changeScene(&quot;level&quot;, 1, SceneManager.flipWithFade, easing.outBack) \tend end   function level:onExitBegin()     self:removeEventListener(Event.ENTER_FRAME, self.onEnterFrame, self) end <\/code><\/pre>\n<p>  <\/div>\n<\/div>\n<p>  \u041d\u0443 \u0432\u043e\u0442 \u0438 \u0432\u0441\u0435. \u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043a\u0430\u0436\u0443 \u043a\u0430\u043a \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u044f\u043c\u043e \u043d\u0430 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435 \u00ab\u043d\u0430 \u043b\u0435\u0442\u0443\u00bb.<\/p>\n<p>  \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043d\u0430 \u0430\u043d\u0434\u0440\u043e\u0438\u0434 \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d \u0438\u0437 \u043f\u0430\u043f\u043a\u0438 Gideros apk \u0444\u0430\u0439\u043b <i>GiderosAndroidPlayer.apk<\/i> \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c. \u0422\u0435\u043f\u0435\u0440\u044c \u0432 Gideros Studio \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043d\u0430\u0448\u0435 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e (\u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d \u043a \u0442\u043e\u043c\u0443 \u0436\u0435 Wi-Fi, \u0447\u0442\u043e \u0438 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440):<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/e82\/bdd\/fd7\/e82bddfd765243b5b2ada1fc2d437554\"\/><\/p>\n<p>  \u0422\u0443\u0442 \u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u00abstegges\u00bb \u2014 \u044d\u0442\u043e \u043d\u0430\u0448 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440, \u0430 \u00abHTC One Mini 2\u00bb \u2014 \u044d\u0442\u043e \u043d\u0430\u0448 \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d, \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0435\u0433\u043e. \u041d\u0443 \u0430 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u0436\u0438\u043c\u0430\u0435\u043c \u043a\u043d\u043e\u043f\u043a\u0443 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432 Gideros Studio \u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0438\u0433\u0440\u0430\u0442\u044c.<\/p>\n<h4>\u041a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442<\/h4>\n<p>  \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u0443\u0435\u043c \u043d\u0430\u0448\u0443 \u0438\u0433\u0440\u0443 \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u043d\u0430 \u0430\u043d\u0434\u0440\u043e\u0438\u0434 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0435. \u0417\u0430\u0445\u043e\u0434\u0438\u043c \u0432 \u043f\u0443\u043d\u043a\u0442 \u043c\u0435\u043d\u044e \u00abFile\u00bb \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u00abExport project\u00bb (cmd+E), \u0432\u0438\u0434\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435 \u043e\u043a\u043d\u043e.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/2d4\/805\/69b\/2d480569bdd14984b5d5d673356e39c2\"\/><\/p>\n<p>  \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u00abAndroid\u00bb \u0438\u0437 \u0432\u044b\u043f\u0430\u0434\u0430\u044e\u0449\u0435\u0433\u043e \u0441\u043f\u0438\u0441\u043a\u0430 \u0438\u043b\u0438 \u0437\u0430\u043a\u043b\u0430\u0434\u043e\u043a. \u0412\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0440\u0435\u0434\u0443 \u0434\u043b\u044f \u043a\u0430\u043a\u043e\u0439 \u0431\u0443\u0434\u0435\u0442 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d \u043f\u0440\u043e\u0435\u043a\u0442, \u0432 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 Eclipse. \u0412\u0432\u043e\u0434\u0438\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043f\u0430\u043a\u0435\u0442\u0430.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/68f\/7a6\/e95\/68f7a6e958724d1f8923553186f09f63\"\/><\/p>\n<p>  \u041d\u0430\u0436\u0438\u043c\u0430\u0435\u043c OK \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u043a\u0443\u0434\u0430 \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u043f\u0440\u043e\u0435\u043a\u0442. \u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c Eclipse, \u041f\u041a\u041c \u0432 Package Explorer &#8212;&gt; Import &#8212;&gt; Existing Android Code &#8212;&gt; \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u0441 \u043d\u0430\u0448\u0438\u043c \u044d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c &#8212;&gt; Finish &#8212;&gt; \u041f\u041a\u041c \u043f\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0443 \u0432 Package Explorer &#8212;&gt; Android Tools \u2014 &gt; Export Signed App\u2026 &#8212;&gt; \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043d\u0430\u0448 \u043a\u043b\u044e\u0447 \u0434\u043b\u044f \u043f\u043e\u0434\u043f\u0438\u0441\u0438 \u0438 \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u0430\u043f\u043a\u0443 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u0430\u043f\u043a. \u0413\u043e\u0442\u043e\u0432\u043e. \u0414\u0443\u043c\u0430\u044e, \u043e\u0431\u044a\u044f\u0441\u043d\u0438\u043b \u0434\u043e\u0445\u043e\u0434\u0447\u0438\u0432\u043e. \u0416\u0434\u0443 \u0441\u043e\u0432\u0435\u0442\u043e\u0432 \u043f\u043e \u0441\u0442\u0430\u0442\u044c\u0435 \u0438 \u043a\u043e\u0434\u0443. \u0415\u0441\u043b\u0438 \u0431\u0443\u0434\u0435\u0442 \u0436\u0435\u043b\u0430\u043d\u0438\u0435 \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u0435, \u0442\u043e \u0441\u0434\u0435\u043b\u0430\u044e \u0435\u0449\u0435 \u0443\u0440\u043e\u043a\u0438.<\/p>\n<p>  <a href=\"https:\/\/yadi.sk\/d\/mkl5N27SiRFdR\">\u041e\u0431\u0435\u0449\u0430\u043d\u043d\u044b\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438<\/a><br \/>  <a href=\"https:\/\/yadi.sk\/d\/HB2vAA2MiRFmP\">\u0410\u043f\u043a\u0448\u043d\u0438\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0430<\/a><br \/>  \u0418 \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 <a href=\"https:\/\/yadi.sk\/d\/my1iUHvEiRFvk\">\u043f\u043b\u0435\u0435\u0440 \u0434\u043b\u044f \u0410\u043d\u0434\u0440\u043e\u0438\u0434<\/a>             <\/p>\n<div class=\"clear\"><\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"http:\/\/habrahabr.ru\/post\/264659\/\"> http:\/\/habrahabr.ru\/post\/264659\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>             \u0414\u0430\u0432\u043d\u0435\u043d\u044c\u043a\u043e \u0431\u044b\u043b\u0430 \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u0440\u043e <a href=\"http:\/\/habrahabr.ru\/post\/148311\/\">Gideros<\/a>, \u043d\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u044f \u044f \u0442\u0430\u043a \u0438 \u043d\u0435 \u043d\u0430\u0448\u0435\u043b. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0434\u0435\u043b\u0430\u043b \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0441\u0442\u0430\u0442\u0435\u0439\u043a\u0443 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u0433\u0440\u044b \u043d\u0430 Gideros Studio. \u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0438 \u0430\u043f\u043a\u0448\u043d\u0438\u043a \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438. \u041f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c.<\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/files\/d34\/644\/bf4\/d34644bf4df54efb9f2ceafee7dee3fb\"\/>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-263470","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/263470","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=263470"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/263470\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=263470"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=263470"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=263470"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}