From: Alexis Laferrière Date: Mon, 19 Jun 2017 20:30:46 +0000 (-0400) Subject: action_nitro: animate the parachute opening X-Git-Url: http://nitlanguage.org action_nitro: animate the parachute opening Signed-off-by: Alexis Laferrière --- diff --git a/contrib/action_nitro/art/planes.svg b/contrib/action_nitro/art/planes.svg index 5835292..690bbdb 100644 --- a/contrib/action_nitro/art/planes.svg +++ b/contrib/action_nitro/art/planes.svg @@ -12,7 +12,7 @@ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" id="svg2998" version="1.1" - inkscape:version="0.48.5 r10040" + inkscape:version="0.92.1 r15371" width="524.4095" height="372.04725" xml:space="preserve" @@ -21,6 +21,18 @@ rdf:about="">image/svg+xml \ No newline at end of file + id="path3452-8-7" /> \ No newline at end of file diff --git a/contrib/action_nitro/src/action_nitro.nit b/contrib/action_nitro/src/action_nitro.nit index f928a85..4fdf39e 100644 --- a/contrib/action_nitro/src/action_nitro.nit +++ b/contrib/action_nitro/src/action_nitro.nit @@ -41,6 +41,9 @@ redef class App # Textures of the biplane, jet, helicopter, parachute and powerups var planes_sheet = new PlanesImages + # Animation when opening the parachute + var parachute_animation = new Animation(planes_sheet.parachute, 16.0) + # Animation for the player movement private var running_texture = new Texture("textures/player.png") private var running_animation: Animation = running_texture.to_animation(10.0, 12, 0) @@ -525,8 +528,12 @@ redef class Enemy end redef class Parachute - redef var sprite = new Sprite(app.planes_sheet.parachute, center) is lazy - init do sprite.scale = width / sprite.texture.width + redef var sprite = new Sprite(app.planes_sheet.parachute_open, center) is lazy + init + do + sprite.scale = width / sprite.texture.width + sprite.animate app.parachute_animation + end end redef class Player