From: Alexis Laferrière Date: Wed, 24 Jan 2018 18:03:51 +0000 (-0500) Subject: contrib: remove crazy_moles X-Git-Url: http://nitlanguage.org contrib: remove crazy_moles Signed-off-by: Alexis Laferrière --- diff --git a/contrib/crazy_moles/.gitignore b/contrib/crazy_moles/.gitignore deleted file mode 100644 index daa854d..0000000 --- a/contrib/crazy_moles/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -src/drawing.nit -assets/images/ -android/ diff --git a/contrib/crazy_moles/Makefile b/contrib/crazy_moles/Makefile deleted file mode 100644 index 7b91216..0000000 --- a/contrib/crazy_moles/Makefile +++ /dev/null @@ -1,40 +0,0 @@ - -SVG2ICONS=../inkscape_tools/bin/svg_to_icons -SVG2PNG=../inkscape_tools/bin/svg_to_png_and_nit - -default: bin/moles - -pre-build: assets/images/drawing.png - -bin/moles: $(shell nitls -M src/moles_linux.nit) assets/images/drawing.png - mkdir -p bin - nitc -o bin/moles src/moles_linux.nit - -android: bin/moles.apk -bin/moles.apk: android/res/ $(shell nitls -M src/moles_android.nit) assets/images/drawing.png - mkdir -p bin - nitc -o bin/moles.apk src/moles_android.nit - -android-release: android/res/ $(shell nitls -M src/moles_android.nit) assets/images/drawing.png - mkdir -p bin - nitc -o bin/moles.apk src/moles_android.nit --release - -$(SVG2ICONS): - $(MAKE) -C ../inkscape_tools - -android/res/: $(SVG2ICONS) art/icon.svg - mkdir -p android/res - $(SVG2ICONS) art/icon.svg --android --out android/res/ - -android-install: bin/moles.apk - adb install -rf bin/moles.apk - -assets/images/drawing.png: art/drawing.svg $(SVG2ICONS) - mkdir -p assets/images - $(SVG2PNG) --src src/ --scale 2.0 art/drawing.svg - -check-android: bin/moles.apk - ../../misc/jenkins/check_android.sh bin/moles.apk - -clean: - rm -rf bin android diff --git a/contrib/crazy_moles/README.md b/contrib/crazy_moles/README.md deleted file mode 100644 index a4c7b2d..0000000 --- a/contrib/crazy_moles/README.md +++ /dev/null @@ -1 +0,0 @@ -Crazy Moles, a very simple portable whack-a-mole style game with particle effects! diff --git a/contrib/crazy_moles/art/drawing.svg b/contrib/crazy_moles/art/drawing.svg deleted file mode 100644 index 665b93f..0000000 --- a/contrib/crazy_moles/art/drawing.svg +++ /dev/null @@ -1,3383 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Warning! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Cute GroundhogInfestation!!! - - - - - - - - - - - - - - - - - - Hits: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10 - - - - - - - - - - - - - - - - - - - - - HAHA! - - - - - - - - - - - - - - - - - - Points - - - - - - - - - - - - - - - - - - - diff --git a/contrib/crazy_moles/art/icon.svg b/contrib/crazy_moles/art/icon.svg deleted file mode 100644 index 992f5a5..0000000 --- a/contrib/crazy_moles/art/icon.svg +++ /dev/null @@ -1,135 +0,0 @@ - - - - - - - - - - image/svg+xml - - - - - - - - - - - - - - - - - - - - - - - diff --git a/contrib/crazy_moles/org.nitlanguage.moles_android.txt b/contrib/crazy_moles/org.nitlanguage.moles_android.txt deleted file mode 100644 index d160073..0000000 --- a/contrib/crazy_moles/org.nitlanguage.moles_android.txt +++ /dev/null @@ -1,10 +0,0 @@ -Categories:Nit,Games -License:Apache2 -Web Site:http://nitlanguage.org -Source Code:http://nitlanguage.org/nit.git/tree/HEAD:/examples/mnit_moles -Issue Tracker:https://github.com/nitlang/nit/issues - -Summary:Wack-a-Mole game -Description: -Tap on cute groundhogs that infest the lawn, but avoid the cactuses. -. diff --git a/contrib/crazy_moles/package.ini b/contrib/crazy_moles/package.ini deleted file mode 100644 index 719752f..0000000 --- a/contrib/crazy_moles/package.ini +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name=crazy_moles -tags=game -maintainer=Alexis Laferrière -license=Apache-2.0 -[upstream] -browse=https://github.com/nitlang/nit/tree/master/contrib/crazy_moles/ -git=https://github.com/nitlang/nit.git -git.directory=contrib/crazy_moles/ -homepage=http://nitlanguage.org -issues=https://github.com/nitlang/nit/issues -apk=http://nitlanguage.org/fdroid/apk/moles_android.apk diff --git a/contrib/crazy_moles/src/effects.nit b/contrib/crazy_moles/src/effects.nit deleted file mode 100644 index a34a864..0000000 --- a/contrib/crazy_moles/src/effects.nit +++ /dev/null @@ -1,339 +0,0 @@ -# This file is part of NIT ( http://www.nitlanguage.org ). -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Graphical effects -module effects - -intrude import geometry::points_and_lines -import mnit::opengles1 - -import moles - -# Position, or vector -class Pos - super Point[Float] - - # Addition of `self` and `other` - fun +(other: Pos): Pos do return new Pos(other.x + x, other.y + y) -end - -redef class PointerEvent - # Convert to `Pos` - fun to_pos: Pos do return new Pos(x, y) -end - -redef class Float - # Pretty alias to `pow` - private fun ^(other: Float): Float do return self.pow(other) -end - -# Graphical effect -abstract class Effect - # Time of creation since (appropriate) app lauch - var created_at: Float = app.clock.total.to_f - - # Is this effect dead? - var dead = false - - # Time to live of this effect, in seconds - var ttl: Float = ttl_base + ttl_rand.rand is lazy - - # Time to live base value - private var ttl_base: Float - - # Variation range to add to `ttl_base` - private var ttl_rand: Float - - private fun update_and_draw(display: Display, t: Float) do end -end - -# Full screen flash -class Flash - super Effect - - # Red value - var r: Float - - # Green value - var g: Float - - # Blue value - var b: Float - - # Start alpha value - var a: Float - - # Reduction in alpha value per seconds - var da: Float - - redef fun update_and_draw(display, t) - do - var dt = t - created_at - var a = a - da * dt - if a <= 0.0 then - dead = true - return - end - - native_flash(r, g, b, a, display.width.to_f, display.height.to_f) - end - - private fun native_flash(r, g, b, a, w, h: Float) `{ - GLfloat colors[] = - { - r, g, b, a, - r, g, b, a, - r, g, b, a, - r, g, b, a, - }; - GLfloat coords[] = - { - 0.0, 0.0, 0.0, - 0.0, h, 0.0, - w, 0.0, 0.0, - w, h, 0.0, - }; - - glLoadIdentity(); - - glEnableClientState(GL_VERTEX_ARRAY); - glEnableClientState(GL_COLOR_ARRAY); - - glEnable(GL_BLEND); - glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - - glDisable(GL_DEPTH_TEST); - glDisable(GL_TEXTURE_2D); - - glVertexPointer(3, GL_FLOAT, 0, coords); - glColorPointer(4, GL_FLOAT, 0, colors); - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - glDisableClientState(GL_VERTEX_ARRAY); - glDisableClientState(GL_COLOR_ARRAY); - glDisable(GL_BLEND); - - if ((mnit_opengles_error_code = glGetError()) != GL_NO_ERROR) { - fprintf(stderr, "Error drawing: %i\n", mnit_opengles_error_code); - } - `} -end - -# Visible particle -abstract class Particle - super Effect - - # Effect image - var img: Image -end - -# Particle moving along a cubic Bézier curve -class CubicBezierParticle - super Particle - - # Points on this curve, from the start to the end with the handles in the middle - # - # Require: `points.length == 4` - var points: Array[Pos] - - redef fun update_and_draw(display, t) - do - assert points.length == 4 - - var dt = t - created_at - var p = dt / ttl - - var i = 1.0-p - var bx = i*i*i * points[0].x + 3.0*i*i*p * points[1].x + - 3.0*i*p*p * points[2].x + p*p*p*points[3].x - var by = i*i*i * points[0].y + 3.0*i*i*p * points[1].y + - 3.0*i*p*p * points[2].y + p*p*p*points[3].y - - img.scale = display_scale - if display isa Opengles1Display then display.color(1.0, 1.0, 1.0, p) - display.blit_centered(img, bx, by) - if display isa Opengles1Display then display.reset_color - - if dt > ttl then dead = true - end -end - -# Particle falling like a feather -class FeatheryParticle - super Particle - - # Origin of effect - var from: Pos - - # Randomized variation so this particle is unique - var ddt: Float = pi.rand - - # Direction: `-1.0` for left, `1.0` for right - var dir: Float = if 2.rand == 0 then -1.0 else 1.0 - - # Randomized variation on X - var ddx: Float = (4.0 - 8.0.rand)^2.0 - - # Randomized variation on Y - var ddy: Float = (12.0 - 24.0.rand)^2.0 - - redef fun update_and_draw(display, t) - do - var dt = t - created_at - - var dx = ddx + 30.0*(dt+ddt).sin - dx *= dir - var dy = ddy + 20.0*dt + 16.0*(dt*2.0+ddt*2.0).cos - var pos = from + new Pos(dx, dy) - - if display isa Opengles1Display then display.color(1.0, 1.0, 1.0, 5.0-5.0*dt/ttl) - display.blit_centered(img, pos.x, pos.y) - if display isa Opengles1Display then display.reset_color - - if dt > ttl then dead = true - end -end - -# Particles that start small then grow bigger and fade out -private class BlowUpParticle - super Particle - - # Origin/center of effect - var from: Pos - - redef fun update_and_draw(display, t) - do - var dt = t - created_at - var p = dt/ttl - - if display isa Opengles1Display then display.color(1.0, 1.0, 1.0, 2.0-p*2.0) - - img.scale = p*4.0*display_scale - display.blit_centered(img, from.x, from.y) - - if display isa Opengles1Display then display.reset_color - - if dt > ttl then dead = true - end -end - -redef class Screen - private var particles = new Array[Particle] - private var flashes = new Array[Flash] - - redef fun draw_hud(display) - do - var t = app.clock.total.to_f - - # Particles - for particle in particles do particle.update_and_draw(display, t) - for particle in particles.reverse_iterator do if particle.dead then - particles.remove particle - end - - # Flashes - for flash in flashes do flash.update_and_draw(display, t) - for flash in flashes.reverse_iterator do if flash.dead then - flashes.remove flash - end - - super - end - - private var score_center = new Pos(48.0*display_scale, 32.0*display_scale) is lazy - private var score_entry = new Pos(48.0*display_scale, 256.0*display_scale) is lazy - - private var score_history = new List[Int] - private var score_history_max_length = 60 - - redef fun draw_score(display, score) - do - # Use an history to smooth the score - score_history.add game.points - if score_history.length > score_history_max_length then score_history.shift - var sum = 0 - for h in score_history do sum += h - var avg = sum.to_f/score_history.length.to_f - var d = game.points.to_f - avg - - # Color the score according to positive or negative changes - var r = 1.0 - var g = 1.0 - var b = 1.0 - if d > 0.0 then - r = 1.0-d.to_f/2.0 - b = r - g = 1.0-d.to_f/10.0 - else if d < 0.0 then - g = 1.0+d.to_f/5.0 - b = g - end - - if display isa Opengles1Display then display.color(r, g, b, 1.0) - - # Draw the score itself - super(display, avg.to_i) - - if display isa Opengles1Display then display.reset_color - end -end - -redef class HoleContent - # Add a `CubicBezierParticle` from `event` to the score box with `img` - private fun bezier_to_score(img: Image, event: PointerEvent) - do - app.screen.particles.add new CubicBezierParticle(2.0, 0.0, img, - [event.to_pos, event.to_pos + new Pos(0.0, -128.0), - app.screen.score_entry, app.screen.score_center]) - end -end - -redef class Mole - - # Number of hair particles - private var n_hair_on_hit = 20 - - redef fun hit(game, hole, event) - do - super - - app.assets.hair.scale = display_scale - for i in n_hair_on_hit.times do - app.screen.particles.add new FeatheryParticle(2.0, 2.0, app.assets.hair, event.to_pos) - end - - bezier_to_score(app.assets.point, event) - app.screen.particles.add new BlowUpParticle(0.5, 0.0, app.assets.point, event.to_pos) - end -end - -redef class Trap - # Image for `CubicBezierParticle` effect towards the score board - protected fun penalty_img: Image do return app.assets.penalty_ten - - # `Flash` effects on hit - protected fun flashes: Array[Flash] do - return [new Flash(0.5, 0.0, 1.0, 0.0, 0.0, 0.5, 2.0)] - end - - redef fun hit(game, hole, event) - do - super - - bezier_to_score(penalty_img, event) - app.screen.particles.add new BlowUpParticle(0.5, 0.0, penalty_img, event.to_pos) - - app.screen.flashes.add_all flashes - end -end diff --git a/contrib/crazy_moles/src/moles.nit b/contrib/crazy_moles/src/moles.nit deleted file mode 100644 index 514b71f..0000000 --- a/contrib/crazy_moles/src/moles.nit +++ /dev/null @@ -1,344 +0,0 @@ -# This file is part of NIT (http://www.nitlanguage.org). -# -# Copyright 2012-2014 Alexis Laferrière -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Classic moles game -# -# This is a minimal practical example of the mnit framework. -module moles is - app_version(1, 0, git_revision) - app_name("Crazy Groundhogs") -end - -import mnit -import realtime - -import drawing - -# A hole with a possible mole, or a trap in it -class Hole - var game: Game - - # Horizontal center of the hole - var x: Int - - # Vertical center of the hole - var y: Int - - # Half width of the hit box - var dx = 200.0 - - # Height of the hit box - var dy = 800.0 - - # Content (and state) of this hole - var content: nullable HoleContent = null - - # Time at witch this hole can act again - var timeout_until: Float = app.clock.total.to_f is lazy - - # Timeout for 1/2 sec or less with a higher score - private fun reset_timeout do - timeout_until = app.clock.total.to_f + - 0.5 - 0.4 * (game.points.to_f / 1000.0).min(1.0) - end - - fun do_turn - do - if timeout_until > app.clock.total.to_f then return - - var content = content - if content != null then - if content == game.down then - if (20.0*game.speed_modifier).to_i.rand == 0 then - # dead / hide - self.content = null - reset_timeout - end - else if (80.0*game.speed_modifier).to_i.rand == 0 then - # hide - self.content = null - reset_timeout - end - else if (100.0*game.speed_modifier).to_i.rand == 0 then - self.content = to_pop - reset_timeout - end - end - - # Get next `HoleContent` to pop - fun to_pop: HoleContent - do - # show traps only at 10 points and up - if game.points > 10 then - - # After 50 points we have more and more traps until point 1000 - var d = 1250-(game.points - 50) - if d < 200 then d = 200 - - if d.rand < 100 then return game.trap - end - - return game.up - end - - # Does this hole intercepts `event`? - fun intercepts(event: PointerEvent): Bool - do - if content == null then return false - - var dx = (dx*display_scale).to_i - var dy = (dy*display_scale).to_i - var ex = event.x.to_i - display_offset_x - var ey = event.y.to_i - display_offset_y - return ex > x - dx and ex < x + dx and - ey > y - dy and ey < y - end - - # Draw this hole and content to `display` - fun draw(display: Display) - do - # The hole itself - var img = app.assets.empty - var dx = 300.0*display_scale - var dy = 256.0*display_scale - img.scale = display_scale - display.blit(img, x-dx.to_i+display_offset_x, y-dy.to_i+display_offset_y) - - # The mole in the hole, or other content - var content = self.content - if content != null then - content.draw(display, x, y) - end - end -end - -# Content of a `Hole` -class HoleContent - # Image - var img: Image - - # Offset of the horizontal center of the hole - var dx: Float - - # Offset of the vertical center of the hole - var dy: Float - - # Hit this hole content - fun hit(game: Game, hole: Hole, event: PointerEvent) do end - - # Draw this content to `display` - fun draw(display: Display, x, y: Int) - do - img.scale = display_scale - display.blit(img, - x-dx.to_i+display_offset_x, - y-dy.to_i+display_offset_y) - end -end - -# A mole in a hole -class Mole - super HoleContent - - # Points value when hit - var value: Int - - redef fun hit(game, hole, event) - do - game.points += value - hole.content = game.down - end -end - -# A trap held out of a hole -class Trap - super HoleContent - - # Points penalty when hit - var penalty: Int - - redef fun hit(game, hole, event) - do - game.points -= penalty - if game.points < 0 then game.points = 0 - hole.content = null - end -end - -class Game - # All holes, filled or not - var holes = new Array[Hole] - - # rule / const - var modifier_half_life = 1000.0 - - # Row count - fun rows: Int do return 4 - - # Columns count - fun columns: Int do return 5 - - # Score - var points = 0 - - # Acceleration - var speed_modifier = 1.0 - - # Vertical offset between rows - var dist_between_rows = 448 - - # Horizontal offset between columns - var dist_between_columns = 600 - - # Global accumulation control, applied to `speed_modifier` - fun global_speed_modifier: Float do return 2.0 - - # A mole, in a hole - var up = new Mole(app.assets.up, 212.0*display_scale, 820.0*display_scale, 1) is lazy - - # A mole that was hit - var down = new HoleContent(app.assets.hit, 250.0*display_scale, 512.0*display_scale) is lazy - - # A trap out of the hole - var trap = new Trap(app.assets.trap, 212.0*display_scale, 830.0*display_scale, 10) is lazy - - init - do - var dx = (dist_between_columns.to_f*display_scale).to_i - var dy = (dist_between_rows.to_f*display_scale).to_i - for x in [0 .. columns[ do - for y in [0 .. rows[ do - holes.add(new Hole(self, x*dx, y*dy)) - end - end - end - - fun do_turn - do - for hole in holes do hole.do_turn - - speed_modifier = modifier_half_life / (modifier_half_life+points.to_f) * global_speed_modifier - end -end - -# Where all the UI stuff is done -class Screen - # The running game - var game = new Game is lazy - - fun do_frame(display: Display) - do - display.clear(0.0, 0.45, 0.0) - - app.assets.sign_warning.scale = display_scale - display.blit(app.assets.sign_warning, (380.0*display_scale).to_i, (256.0*display_scale).to_i) - - app.assets.sign_cute.scale = display_scale - display.blit(app.assets.sign_cute, (1024.0*display_scale).to_i, (64.0*display_scale).to_i) - - for hole in game.holes do - hole.draw display - end - - draw_hud display - end - - fun input(event: InputEvent): Bool - do - if event isa PointerEvent then - for hole in game.holes.reverse_iterator do - if hole.intercepts(event) then - var hole_content = hole.content - if hole_content != null then hole_content.hit(game, hole, event) - return true - end - end - end - - return false - end - - # Draw the HUD as the topmost layer of the screen - fun draw_hud(display: Display) - do - var board = app.assets.points_board - board.scale = display_scale - display.blit(board, (32.0*display_scale).to_i, -10) - - draw_score(display) - end - - # Draw the score - fun draw_score(display: Display, score: nullable Int) - do - if score == null then score = game.points - - # Draw the score itself - for img in app.numbers.imgs do img.scale = display_scale - display.blit_number(app.numbers, score, - (92.0*display_scale).to_i, - (172.0*display_scale).to_i) - end -end - -redef class App - - # Main play screen - var screen = new Screen - - # Image set generate by inkscape_tools - var assets = new DrawingImages - - # Numbers to display the score - var numbers = new NumberImages(assets.n) - - # Elapsed time since program launch - var clock = new Clock - - redef fun on_create - do - super - - assets.load_all self - maximum_fps = 50.0 - end - - redef fun frame_core(display) - do - screen.game.do_turn - screen.do_frame(display) - end - - redef fun input(ie) - do - if ie isa QuitEvent or - (ie isa KeyEvent and ie.to_c == 'q') then - quit = true - return true - end - - return screen.input(ie) - end -end - -# Main zoom -fun display_scale: Float do return 1.0 - -# Depends on the hole center in the uo image -fun display_offset_x: Int do return (512.0*display_scale).to_i - -# Depends on the width of the holes -fun display_offset_y: Int do return (1000.0*display_scale).to_i diff --git a/contrib/crazy_moles/src/moles_android.nit b/contrib/crazy_moles/src/moles_android.nit deleted file mode 100644 index c2c7f58..0000000 --- a/contrib/crazy_moles/src/moles_android.nit +++ /dev/null @@ -1,51 +0,0 @@ -# This file is part of NIT ( http://www.nitlanguage.org ). -# -# Copyright 2012-2014 Alexis Laferrière -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -module moles_android - -import mnit::android -import android::portrait - -import moles -import effects -import more_traps - -redef class Game - redef fun columns do return 3 - redef fun rows do return 5 -end - -redef class App - redef fun on_create - do - # We use as a reference the Moto X - var tw = 720 - var th = 1184 - - # Calculate the scale to fit a Moto X screen in this device screen - var xs = display.width.to_f/tw.to_f*0.4 - var ys = display.height.to_f/th.to_f*0.4 - - # Use the smaller scale so everything fits - display_scale_container.item = xs.min(ys) - - super - end -end - -fun display_scale_container: Ref[Float] do return once new Ref[Float](0.1) -redef fun display_scale do return display_scale_container.item -redef fun display_offset_x: Int do return (300.0*display_scale).to_i diff --git a/contrib/crazy_moles/src/moles_linux.nit b/contrib/crazy_moles/src/moles_linux.nit deleted file mode 100644 index c46b29b..0000000 --- a/contrib/crazy_moles/src/moles_linux.nit +++ /dev/null @@ -1,25 +0,0 @@ -# This file is part of NIT ( http://www.nitlanguage.org ). -# -# Copyright 2012-2013 Alexis Laferrière -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -module moles_linux - -import mnit::linux - -import moles -import effects -import more_traps - -redef fun display_scale do return 0.25 diff --git a/contrib/crazy_moles/src/more_traps.nit b/contrib/crazy_moles/src/more_traps.nit deleted file mode 100644 index cf64cc5..0000000 --- a/contrib/crazy_moles/src/more_traps.nit +++ /dev/null @@ -1,58 +0,0 @@ -# This file is part of NIT ( http://www.nitlanguage.org ). -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# Add more traps -module more_traps - -import moles -import effects - -# Nuclear trap -class Nuke - super Trap - - redef fun penalty_img do return app.assets.penalty_hundred - - redef fun flashes do return [ - new Flash(5.0, 0.0, 1.0, 0.0, 0.0, 1.25, 2.0), - new Flash(0.2, 0.0, 1.0, 1.0, 1.0, 1.0, 2.0)] -end - -# Large cactus trap -class BigTrap - super Trap - - redef fun penalty_img do return app.assets.penalty_twenty -end - -redef class Game - - # Nuclear trap - var nuke = new Nuke(app.assets.nuke, 180.0*display_scale, 780.0*display_scale, 100) is lazy - - # Large cactus trap - var big_cactus = new BigTrap(app.assets.big_cactus, 242.0*display_scale, 820.0*display_scale, 20) is lazy -end - -redef class Hole - redef fun to_pop - do - if game.points > 25 then - if 25.rand == 0 then return game.big_cactus - if game.points > 50 and 100.rand == 0 then return game.nuke - end - - return super - end -end