summaryrefslogtreecommitdiffhomepage
path: root/samples/99_genre_platformer/clepto_frog/app
diff options
context:
space:
mode:
authorAmir Rajan <[email protected]>2020-09-11 02:02:01 -0500
committerAmir Rajan <[email protected]>2020-09-11 02:02:57 -0500
commit33ec37b141e896b47ed642923fd33b0c658ae9fb (patch)
treea40d3e5d41beeb06508200078f6f26b0ee57d6a4 /samples/99_genre_platformer/clepto_frog/app
parent958cf43779d2bf528869e80511c4c4f2a433b2db (diff)
downloaddragonruby-game-toolkit-contrib-33ec37b141e896b47ed642923fd33b0c658ae9fb.tar.gz
dragonruby-game-toolkit-contrib-33ec37b141e896b47ed642923fd33b0c658ae9fb.zip
synced samples
Diffstat (limited to 'samples/99_genre_platformer/clepto_frog/app')
-rw-r--r--samples/99_genre_platformer/clepto_frog/app/main.rb864
-rw-r--r--samples/99_genre_platformer/clepto_frog/app/map.rb1025
2 files changed, 1889 insertions, 0 deletions
diff --git a/samples/99_genre_platformer/clepto_frog/app/main.rb b/samples/99_genre_platformer/clepto_frog/app/main.rb
new file mode 100644
index 0000000..a4eb069
--- /dev/null
+++ b/samples/99_genre_platformer/clepto_frog/app/main.rb
@@ -0,0 +1,864 @@
+MAP_FILE_PATH = 'app/map.txt'
+
+require 'app/map.rb'
+
+class CleptoFrog
+ attr_gtk
+
+ def render_ending
+ state.game_over_at ||= state.tick_count
+
+ outputs.labels << [640, 700, "Clepto Frog", 4, 1]
+
+ if state.tick_count >= (state.game_over_at + 120)
+ outputs.labels << [640, 620, "\"I... I.... don't believe it.\" - New Guy",
+ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 120).ease(60)]
+ end
+
+ if state.tick_count >= (state.game_over_at + 240)
+ outputs.labels << [640, 580, "\"He actually stole all the mugs?\" - New Guy",
+ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 240).ease(60)]
+ end
+
+ if state.tick_count >= (state.game_over_at + 360)
+ outputs.labels << [640, 540, "\"Kind of feel bad STARTING HIM WITH NOTHING again.\" - New Guy",
+ 4, 1, 0, 0, 0, 255 * (state.game_over_at + 360).ease(60)]
+ end
+
+ outputs.sprites << [640 - 50, 360 - 50, 100, 100,
+ "sprites/square-green.png"]
+
+ outputs.labels << [640, 300, "Current Time: #{"%.2f" % state.stuff_time}", 4, 1]
+ outputs.labels << [640, 270, "Best Time: #{"%.2f" % state.stuff_best_time}", 4, 1]
+
+ if state.tick_count >= (state.game_over_at + 550)
+ restart_game
+ end
+ end
+
+ def restart_game
+ state.world = nil
+ state.x = nil
+ state.y = nil
+ state.dx = nil
+ state.dy = nil
+ state.stuff_score = 0
+ state.stuff_time = 0
+ state.intro_tick_count = nil
+ defaults
+ state.game_start_at = state.tick_count
+ state.scene = :game
+ state.game_over_at = nil
+ end
+
+ def render_intro
+ outputs.labels << [640, 700, "Clepto Frog", 4, 1]
+ if state.tick_count >= 120
+ outputs.labels << [640, 620, "\"Uh... your office has a pet frog?\" - New Guy",
+ 4, 1, 0, 0, 0, 255 * 120.ease(60)]
+ end
+
+ if state.tick_count >= 240
+ outputs.labels << [640, 580, "\"Yep! His name is Clepto.\" - Jim",
+ 4, 1, 0, 0, 0, 255 * 240.ease(60)]
+ end
+
+ if state.tick_count >= 360
+ outputs.labels << [640, 540, "\"Uh...\" - New Guy",
+ 4, 1, 0, 0, 0, 255 * 360.ease(60)]
+ end
+
+ if state.tick_count >= 480
+ outputs.labels << [640, 500, "\"He steals mugs while we're away...\" - Jim",
+ 4, 1, 0, 0, 0, 255 * 480.ease(60)]
+ end
+
+ if state.tick_count >= 600
+ outputs.labels << [640, 460, "\"It's not a big deal, we take them back in the morning.\" - Jim",
+ 4, 1, 0, 0, 0, 255 * 600.ease(60)]
+ end
+
+ outputs.sprites << [640 - 50, 360 - 50, 100, 100,
+ "sprites/square-green.png"]
+
+ if state.tick_count == 800
+ state.scene = :game
+ state.game_start_at = state.tick_count
+ end
+ end
+
+ def tick
+ defaults
+ if state.scene == :intro && state.tick_count <= 800
+ render_intro
+ elsif state.scene == :ending
+ render_ending
+ else
+ render
+ end
+ calc
+ process_inputs
+ end
+
+ def defaults
+ state.scene ||= :intro
+ state.stuff_score ||= 0
+ state.stuff_time ||= 0
+ state.stuff_best_time ||= nil
+ state.camera_x ||= 0
+ state.camera_y ||= 0
+ state.target_camera_scale ||= 1
+ state.camera_scale ||= 1
+ state.tongue_length ||= 100
+ state.dev_action ||= :collision_mode
+ state.action ||= :aiming
+ state.tongue_angle ||= 90
+ state.tile_size = 64
+ state.gravity = -0.1
+ state.air = -0.01
+ state.player_width = 60
+ state.player_height = 60
+ state.collision_tolerance = 0.0
+ state.previous_tile_size ||= state.tile_size
+ state.x ||= 2400
+ state.y ||= 200
+ state.dy ||= 0
+ state.dx ||= 0
+ attempt_load_world_from_file
+ state.world_lookup ||= { }
+ state.world_collision_rects ||= []
+ state.mode ||= :creating
+ state.select_menu ||= [0, 720, 1280, 720]
+ state.sprite_quantity ||= 20
+ state.sprite_coords ||= []
+ state.banner_coords ||= [640, 680 + 720]
+ state.sprite_selected ||= 1
+ state.map_saved_at ||= 0
+ state.intro_tick_count ||= state.tick_count
+ if state.sprite_coords == []
+ count = 1
+ temp_x = 165
+ temp_y = 500 + 720
+ state.sprite_quantity.times do
+ state.sprite_coords += [[temp_x, temp_y, count]]
+ temp_x += 100
+ count += 1
+ if temp_x > 1280 - (165 + 50)
+ temp_x = 165
+ temp_y -= 75
+ end
+ end
+ end
+ end
+
+ def start_of_tongue x = nil, y = nil
+ x ||= state.x
+ y ||= state.y
+ [
+ x + state.player_width.half,
+ y + state.player_height.half
+ ]
+ end
+
+ def stage_definition
+ outputs.sprites << [vx(0), vy(0), vw(10000), vw(5875), 'sprites/level-map.png']
+ end
+
+ def render
+ stage_definition
+ start_of_tongue_render = [vx(start_of_tongue.x), vy(start_of_tongue.y)]
+ end_of_tongue_render = [vx(end_of_tongue.x), vy(end_of_tongue.y)]
+
+ if state.anchor_point
+ anchor_point_render = [vx(state.anchor_point.x), vy(state.anchor_point.y)]
+ outputs.sprites << { x: start_of_tongue_render.x,
+ y: start_of_tongue_render.y,
+ w: vw(2),
+ h: args.geometry.distance(start_of_tongue_render, anchor_point_render),
+ path: 'sprites/square-pink.png',
+ angle_anchor_y: 0,
+ angle: state.tongue_angle - 90 }
+ else
+ outputs.sprites << { x: vx(start_of_tongue.x),
+ y: vy(start_of_tongue.y),
+ w: vw(2),
+ h: vh(state.tongue_length),
+ path: 'sprites/square-pink.png',
+ angle_anchor_y: 0,
+ angle: state.tongue_angle - 90 }
+ end
+
+ outputs.sprites << state.objects.map { |o| [vx(o.x), vy(o.y), vw(o.w), vh(o.h), o.path] }
+
+ if state.god_mode
+ # SHOW HIDE COLLISIONS
+ outputs.sprites << state.world.map do |x, y, w, h|
+ x = vx(x)
+ y = vy(y)
+ if x > -80 && x < 1280 && y > -80 && y < 720
+ {
+ x: x,
+ y: y,
+ w: vw(w || state.tile_size),
+ h: vh(h || state.tile_size),
+ path: 'sprites/square-gray.png',
+ a: 128
+ }
+ end
+ end
+ end
+
+ render_player
+ outputs.sprites << [vx(2315), vy(45), vw(569), vh(402), 'sprites/square-blue.png', 0, 40]
+
+ # Label in top left of the screen
+ outputs.primitives << [20, 640, 180, 70, 255, 255, 255, 128].solid
+ outputs.primitives << [30, 700, "Stuff: #{state.stuff_score} of #{$mugs.count}", 1].label
+ outputs.primitives << [30, 670, "Time: #{"%.2f" % state.stuff_time}", 1].label
+
+ if state.god_mode
+ if state.map_saved_at > 0 && state.map_saved_at.elapsed_time < 120
+ outputs.primitives << [920, 670, 'Map has been exported!', 1, 0, 50, 100, 50].label
+ end
+
+
+ # Creates sprite following mouse to help indicate which sprite you have selected
+ outputs.primitives << [inputs.mouse.position.x, inputs.mouse.position.y,
+ state.tile_size, state.tile_size, 'sprites/square-indigo.png', 0, 100].sprite
+ end
+
+ render_mini_map
+ outputs.primitives << [0, 0, 1280, 720, 255, 255, 255, 255 * state.game_start_at.ease(60, :flip)].solid
+ end
+
+ def render_mini_map
+ x, y = 1170, 10
+ outputs.primitives << [x, y, 100, 58, 0, 0, 0, 200].solid
+ outputs.primitives << [x + args.state.x.fdiv(100) - 1, y + args.state.y.fdiv(100) - 1, 2, 2, 0, 255, 0].solid
+ t_start = start_of_tongue
+ t_end = end_of_tongue
+ outputs.primitives << [
+ x + t_start.x.fdiv(100), y + t_start.y.fdiv(100),
+ x + t_end.x.fdiv(100), y + t_end.y.fdiv(100),
+ 255, 255, 255
+ ].line
+
+ state.objects.each do |o|
+ outputs.primitives << [x + o.x.fdiv(100) - 1, y + o.y.fdiv(100) - 1, 2, 2, 200, 200, 0].solid
+ end
+ end
+
+ def calc_camera percentage_override = nil
+ percentage = percentage_override || (0.2 * state.camera_scale)
+ target_scale = state.target_camera_scale
+ distance_scale = target_scale - state.camera_scale
+ state.camera_scale += distance_scale * percentage
+
+ target_x = state.x * state.target_camera_scale
+ target_y = state.y * state.target_camera_scale
+
+ distance_x = target_x - (state.camera_x + 640)
+ distance_y = target_y - (state.camera_y + 360)
+ state.camera_x += distance_x * percentage if distance_x.abs > 1
+ state.camera_y += distance_y * percentage if distance_y.abs > 1
+ state.camera_x = 0 if state.camera_x < 0
+ state.camera_y = 0 if state.camera_y < 0
+ end
+
+ def vx x
+ (x * state.camera_scale) - state.camera_x
+ end
+
+ def vy y
+ (y * state.camera_scale) - state.camera_y
+ end
+
+ def vw w
+ w * state.camera_scale
+ end
+
+ def vh h
+ h * state.camera_scale
+ end
+
+ def calc
+ calc_camera
+ calc_world_lookup
+ calc_player
+ calc_on_floor
+ calc_score
+ end
+
+ def set_camera_scale v = nil
+ return if v < 0.1
+ state.target_camera_scale = v
+ end
+
+ def process_inputs_god_mode
+ return unless state.god_mode
+
+ if inputs.keyboard.key_down.equal_sign || (inputs.keyboard.equal_sign && state.tick_count.mod_zero?(10))
+ set_camera_scale state.camera_scale + 0.1
+ elsif inputs.keyboard.key_down.hyphen || (inputs.keyboard.hyphen && state.tick_count.mod_zero?(10))
+ set_camera_scale state.camera_scale - 0.1
+ elsif inputs.keyboard.eight || inputs.keyboard.zero
+ set_camera_scale 1
+ end
+
+ if input_up?
+ state.y += 10
+ state.dy = 0
+ elsif input_down?
+ state.y -= 10
+ state.dy = 0
+ end
+
+ if input_left?
+ state.x -= 10
+ state.dx = 0
+ elsif input_right?
+ state.x += 10
+ state.dx = 0
+ end
+ end
+
+ def process_inputs
+ if state.scene == :game
+ process_inputs_player_movement
+ process_inputs_god_mode
+ elsif state.scene == :intro
+ if args.inputs.keyboard.key_down.enter || args.inputs.keyboard.key_down.space
+ if Kernel.tick_count < 600
+ Kernel.tick_count = 600
+ end
+ end
+ end
+ end
+
+ def input_up?
+ inputs.keyboard.w || inputs.keyboard.up || inputs.keyboard.k
+ end
+
+ def input_up_released?
+ inputs.keyboard.key_up.w ||
+ inputs.keyboard.key_up.up ||
+ inputs.keyboard.key_up.k
+ end
+
+ def input_down?
+ inputs.keyboard.s || inputs.keyboard.down || inputs.keyboard.j
+ end
+
+ def input_down_released?
+ inputs.keyboard.key_up.s ||
+ inputs.keyboard.key_up.down ||
+ inputs.keyboard.key_up.j
+ end
+
+ def input_left?
+ inputs.keyboard.a || inputs.keyboard.left || inputs.keyboard.h
+ end
+
+ def input_right?
+ inputs.keyboard.d || inputs.keyboard.right || inputs.keyboard.l
+ end
+
+ def set_object path, w, h
+ state.object = path
+ state.object_w = w
+ state.object_h = h
+ end
+
+ def collision_mode
+ state.dev_action = :collision_mode
+ end
+
+ def process_inputs_player_movement
+ if inputs.keyboard.key_down.g
+ state.god_mode = !state.god_mode
+ puts state.god_mode
+ end
+
+ if inputs.keyboard.key_down.u && state.dev_action == :collision_mode
+ state.world = state.world[0..-2]
+ state.world_lookup = {}
+ end
+
+ if inputs.keyboard.key_down.space && !state.anchor_point
+ state.tongue_length = 0
+ state.action = :shooting
+ outputs.sounds << 'sounds/shooting.wav'
+ elsif inputs.keyboard.key_down.space
+ state.action = :aiming
+ state.anchor_point = nil
+ state.tongue_length = 100
+ end
+
+ if state.anchor_point
+ if input_up?
+ if state.tongue_length >= 105
+ state.tongue_length -= 5
+ state.dy += 0.8
+ end
+ elsif input_down?
+ state.tongue_length += 5
+ state.dy -= 0.8
+ end
+
+ if input_left? && state.dx > 1
+ state.dx *= 0.98
+ elsif input_left? && state.dx < -1
+ state.dx *= 1.03
+ elsif input_left? && !state.on_floor
+ state.dx -= 3
+ elsif input_right? && state.dx > 1
+ state.dx *= 1.03
+ elsif input_right? && state.dx < -1
+ state.dx *= 0.98
+ elsif input_right? && !state.on_floor
+ state.dx += 3
+ end
+ else
+ if input_left?
+ state.tongue_angle += 1.5
+ state.tongue_angle = state.tongue_angle
+ elsif input_right?
+ state.tongue_angle -= 1.5
+ state.tongue_angle = state.tongue_angle
+ end
+ end
+ end
+
+ def add_floors
+ # floors
+ state.world += [
+ [0, 0, 10000, 40],
+ [0, 1670, 3250, 60],
+ [6691, 1653, 3290, 60],
+ [1521, 3792, 7370, 60],
+ [0, 5137, 3290, 60]
+ ]
+ end
+
+ def attempt_load_world_from_file
+ return if state.world
+ # exported_world = gtk.read_file(MAP_FILE_PATH)
+ state.world = []
+ state.objects = []
+
+ if $collisions
+ $collisions.map do |x, y, w, h|
+ state.world << [x, y, w, h]
+ end
+
+ add_floors
+ # elsif exported_world
+ # exported_world.each_line.map do |l|
+ # tokens = l.strip.split(',')
+ # x = tokens[0].to_i
+ # y = tokens[1].to_i
+ # type = tokens[2].to_i
+ # if type == 1
+ # state.world << [x, y, state.tile_size, state.tile_size]
+ # elsif type == 2
+ # w, h, path = tokens[3..-1]
+ # state.objects << [x, y, w.to_i, h.to_i, path]
+ # end
+ # end
+
+ # add_floors
+ end
+
+ if $mugs
+ $mugs.map do |x, y, w, h, path|
+ state.objects << [x, y, w, h, path]
+ end
+ end
+ end
+
+ def calc_world_lookup
+ if state.tile_size != state.previous_tile_size
+ state.previous_tile_size = state.tile_size
+ state.world_lookup = {}
+ end
+
+ return if state.world_lookup.keys.length > 0
+ return unless state.world.length > 0
+
+ # Searches through the world and finds the cordinates that exist
+ state.world_lookup = {}
+ state.world.each do |x, y, w, h|
+ state.world_lookup[[x, y, w || state.tile_size, h || state.tile_size]] = true
+ end
+
+ # Assigns collision rects for every sprite drawn
+ state.world_collision_rects =
+ state.world_lookup
+ .keys
+ .map do |x, y, w, h|
+ s = state.tile_size
+ w ||= s
+ h ||= s
+ {
+ args: [x, y, w, h],
+ left_right: [x, y + 4, w, h - 6],
+ top: [x + 4, y + 6, w - 8, h - 6],
+ bottom: [x + 1, y - 1, w - 2, h - 8],
+ }
+ end
+
+ end
+
+ def calc_pendulum
+ return if !state.anchor_point
+ target_x = state.anchor_point.x - start_of_tongue.x
+ target_y = state.anchor_point.y -
+ state.tongue_length - 5 - 20 - state.player_height
+
+ diff_y = state.y - target_y
+
+ if target_x > 0
+ state.dx += 0.6
+ elsif target_x < 0
+ state.dx -= 0.6
+ end
+
+ if diff_y > 0
+ state.dy -= 0.1
+ elsif diff_y < 0
+ state.dy += 0.1
+ end
+
+ state.dx *= 0.99
+
+ if state.dy.abs < 2
+ state.dy *= 0.8
+ else
+ state.dy *= 0.90
+ end
+
+ if state.tongue_length && state.y
+ state.dy += state.tongue_angle.vector_y state.tongue_length.fdiv(1000)
+ end
+ end
+
+ def calc_tongue_angle
+ return unless state.anchor_point
+ state.tongue_angle = args.geometry.angle_from state.anchor_point, start_of_tongue
+ state.tongue_length = args.geometry.distance(start_of_tongue, state.anchor_point)
+ state.tongue_length = state.tongue_length.greater(100)
+ end
+
+ def player_from_end_of_tongue
+ p = state.tongue_angle.vector(state.tongue_length)
+ derived_start = [state.anchor_point.x - p.x, state.anchor_point.y - p.y]
+ derived_start.x -= state.player_width.half
+ derived_start.y -= state.player_height.half
+ derived_start
+ end
+
+ def end_of_tongue
+ p = state.tongue_angle.vector(state.tongue_length)
+ [start_of_tongue.x + p.x, start_of_tongue.y + p.y]
+ end
+
+ def calc_shooting
+ return unless state.action == :shooting
+ state.tongue_length += 30
+ potential_anchor = end_of_tongue
+ if potential_anchor.x <= 0
+ state.anchor_point = potential_anchor
+ state.action = :anchored
+ outputs.sounds << 'sounds/attached.wav'
+ elsif potential_anchor.x >= 10000
+ state.anchor_point = potential_anchor
+ state.action = :anchored
+ outputs.sounds << 'sounds/attached.wav'
+ elsif potential_anchor.y <= 0
+ state.anchor_point = potential_anchor
+ state.action = :anchored
+ outputs.sounds << 'sounds/attached.wav'
+ elsif potential_anchor.y >= 5875
+ state.anchor_point = potential_anchor
+ state.action = :anchored
+ outputs.sounds << 'sounds/attached.wav'
+ else
+ anchor_rect = [potential_anchor.x - 5, potential_anchor.y - 5, 10, 10]
+ collision = state.world_collision_rects.find_all do |v|
+ [v[:args].x, v[:args].y, v[:args].w, v[:args].h].intersect_rect?(anchor_rect)
+ end.first
+ if collision
+ state.anchor_point = potential_anchor
+ state.action = :anchored
+ outputs.sounds << 'sounds/attached.wav'
+ end
+ end
+ end
+
+ def calc_player
+ calc_shooting
+ if !state.god_mode
+ state.dy += state.gravity # Since acceleration is the change in velocity, the change in y (dy) increases every frame
+ state.dx += state.dx * state.air
+ end
+ calc_pendulum
+ calc_box_collision
+ calc_edge_collision
+ if !state.god_mode
+ state.y += state.dy
+ state.x += state.dx
+ end
+ calc_tongue_angle
+ end
+
+ def calc_box_collision
+ return unless state.world_lookup.keys.length > 0
+ collision_floor
+ collision_left
+ collision_right
+ collision_ceiling
+ end
+
+ def calc_edge_collision
+ # Ensures that player doesn't fall below the map
+ if next_y < 0 && state.dy < 0
+ state.y = 0
+ state.dy = state.dy.abs * 0.8
+ state.collision_on_y = true
+ # Ensures player doesn't go insanely high
+ elsif next_y > 5875 - state.tile_size && state.dy > 0
+ state.y = 5875 - state.tile_size
+ state.dy = state.dy.abs * 0.8 * -1
+ state.collision_on_y = true
+ end
+
+ # Ensures that player remains in the horizontal range its supposed to
+ if state.x >= 10000 - state.tile_size && state.dx > 0
+ state.x = 10000 - state.tile_size
+ state.dx = state.dx.abs * 0.8 * -1
+ state.collision_on_x = true
+ elsif state.x <= 0 && state.dx < 0
+ state.x = 0
+ state.dx = state.dx.abs * 0.8
+ state.collision_on_x = true
+ end
+ end
+
+ def next_y
+ state.y + state.dy
+ end
+
+ def next_x
+ if state.dx < 0
+ return (state.x + state.dx) - (state.tile_size - state.player_width)
+ else
+ return (state.x + state.dx) + (state.tile_size - state.player_width)
+ end
+ end
+
+ def collision_floor
+ return unless state.dy <= 0
+
+ player_rect = [state.x, next_y, state.tile_size, state.tile_size]
+
+ # Runs through all the sprites on the field and determines if the player hits the bottom of sprite (hence "-0.1" above)
+ floor_collisions = state.world_collision_rects
+ .find_all { |r| r[:top].intersect_rect?(player_rect, state.collision_tolerance) }
+ .first
+
+ return unless floor_collisions
+ state.y = floor_collisions[:top].top
+ state.dy = state.dy.abs * 0.8
+ end
+
+ def collision_left
+ return unless state.dx < 0
+ player_rect = [next_x, state.y, state.tile_size, state.tile_size]
+
+ # Runs through all the sprites on the field and determines if the player hits the left side of sprite (hence "-0.1" above)
+ left_side_collisions = state.world_collision_rects
+ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }
+ .first
+
+ return unless left_side_collisions
+ state.x = left_side_collisions[:left_right].right
+ state.dx = state.dy.abs * 0.8
+ state.collision_on_x = true
+ end
+
+ def collision_right
+ return unless state.dx > 0
+
+ player_rect = [next_x, state.y, state.tile_size, state.tile_size]
+ # Runs through all the sprites on the field and determines if the player hits the right side of sprite (hence "-0.1" above)
+ right_side_collisions = state.world_collision_rects
+ .find_all { |r| r[:left_right].intersect_rect?(player_rect, state.collision_tolerance) }
+ .first
+
+ return unless right_side_collisions
+ state.x = right_side_collisions[:left_right].left - state.tile_size
+ state.dx = state.dx.abs * 0.8 * -1
+ state.collision_on_x = true
+ end
+
+ def collision_ceiling
+ return unless state.dy > 0
+
+ player_rect = [state.x, next_y, state.player_width, state.player_height]
+
+ # Runs through all the sprites on the field and determines if the player hits the ceiling of sprite (hence "+0.1" above)
+ ceil_collisions = state.world_collision_rects
+ .find_all { |r| r[:bottom].intersect_rect?(player_rect, state.collision_tolerance) }
+ .first
+
+ return unless ceil_collisions
+ state.y = ceil_collisions[:bottom].y - state.tile_size
+ state.dy = state.dy.abs * 0.8 * -1
+ state.collision_on_y = true
+ end
+
+ def to_coord point
+ # Integer divides (idiv) point.x to turn into grid
+ # Then, you can just multiply each integer by state.tile_size
+ # later and huzzah. Grid coordinates
+ [point.x.idiv(state.tile_size), point.y.idiv(state.tile_size)]
+ end
+
+ def export_map
+ export_string = state.world.map do |x, y|
+ "#{x},#{y},1"
+ end
+ export_string += state.objects.map do |x, y, w, h, path|
+ "#{x},#{y},2,#{w},#{h},#{path}"
+ end
+ gtk.write_file(MAP_FILE_PATH, export_string.join("\n"))
+ state.map_saved_at = state.tick_count
+ end
+
+ def inputs_export_stage
+ end
+
+ def calc_score
+ return unless state.scene == :game
+ player = [state.x, state.y, state.player_width, state.player_height]
+ collected = state.objects.find_all { |s| s.intersect_rect? player }
+ state.stuff_score += collected.length
+ if collected.length > 0
+ outputs.sounds << 'sounds/collectable.wav'
+ end
+ state.objects = state.objects.reject { |s| collected.include? s }
+ state.stuff_time += 0.01
+ if state.objects.length == 0
+ if !state.stuff_best_time || state.stuff_time < state.stuff_best_time
+ state.stuff_best_time = state.stuff_time
+ end
+ state.game_over_at = nil
+ state.scene = :ending
+ end
+ end
+
+ def calc_on_floor
+ if state.action == :anchored
+ state.on_floor = false
+ state.on_floor_debounce = 30
+ else
+ state.on_floor_debounce ||= 30
+
+ if state.dy.round != 0
+ state.on_floor_debounce = 30
+ state.on_floor = false
+ else
+ state.on_floor_debounce -= 1
+ end
+
+ if state.on_floor_debounce <= 0
+ state.on_floor_debounce = 0
+ state.on_floor = true
+ end
+ end
+ end
+
+ def render_player
+ path = "sprites/square-green.png"
+ angle = 0
+ # outputs.labels << [vx(state.x), vy(state.y) - 30, "dy: #{state.dy.round}"]
+ if state.action == :idle
+ # outputs.labels << [vx(state.x), vy(state.y), "IDLE"]
+ path = "sprites/square-green.png"
+ elsif state.action == :aiming && !state.on_floor
+ # outputs.labels << [vx(state.x), vy(state.y), "AIMING AIR BORN"]
+ angle = state.tongue_angle - 90
+ path = "sprites/square-green.png"
+ elsif state.action == :aiming # ON THE GROUND
+ # outputs.labels << [vx(state.x), vy(state.y), "AIMING GROUND"]
+ path = "sprites/square-green.png"
+ elsif state.action == :shooting && !state.on_floor
+ # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING AIR BORN"]
+ path = "sprites/square-green.png"
+ angle = state.tongue_angle - 90
+ elsif state.action == :shooting
+ # outputs.labels << [vx(state.x), vy(state.y), "SHOOTING ON GROUND"]
+ path = "sprites/square-green.png"
+ elsif state.action == :anchored
+ # outputs.labels << [vx(state.x), vy(state.y), "SWINGING"]
+ angle = state.tongue_angle - 90
+ path = "sprites/square-green.png"
+ end
+
+ outputs.sprites << [vx(state.x),
+ vy(state.y),
+ vw(state.player_width),
+ vh(state.player_height),
+ path,
+ angle]
+ end
+
+ def render_player_old
+ # Player
+ if state.action == :aiming
+ path = 'sprites\frg\idle\frog_idle.png'
+ if state.dx > 2
+ #directional right sprite was here but i needa redo it
+ path = 'sprites\frg\anchor\frog-anchor-0.png'
+ #directional left sprite was here but i needa redo it
+ elsif state.dx < -2
+ path = 'sprites\frg\anchor\frog-anchor-0.png'
+ end
+ outputs.sprites << [vx(state.x),
+ vy(state.y),
+ vw(state.player_width),
+ vh(state.player_height),
+ path,
+ (state.tongue_angle - 90)]
+ elsif state.action == :anchored || state.action == :shooting
+ outputs.sprites << [vx(state.x),
+ vy(state.y),
+ vw(state.player_width),
+ vw(state.player_height),
+ 'sprites/animations_povfrog/frog_bwah_up.png',
+ (state.tongue_angle - 90)]
+ end
+ end
+end
+
+
+$game = CleptoFrog.new
+
+def tick args
+ if args.state.scene == :game
+ tick_instructions args, "SPACE to SHOOT and RELEASE tongue. LEFT, RIGHT to SWING and BUILD momentum. MINIMAP in bottom right corner.", 360
+ end
+ $game.args = args
+ $game.tick
+end
+
+def tick_instructions args, text, y = 715
+ return if args.state.key_event_occurred
+ if args.inputs.keyboard.directional_vector || args.inputs.keyboard.key_down.space
+ args.state.key_event_occurred = true
+ end
+
+ args.outputs.debug << [0, y - 50, 1280, 60].solid
+ args.outputs.debug << [640, y, text, 1, 1, 255, 255, 255].label
+ args.outputs.debug << [640, y - 25, "(SPACE to dismiss instructions)" , -2, 1, 255, 255, 255].label
+end
diff --git a/samples/99_genre_platformer/clepto_frog/app/map.rb b/samples/99_genre_platformer/clepto_frog/app/map.rb
new file mode 100644
index 0000000..c048c82
--- /dev/null
+++ b/samples/99_genre_platformer/clepto_frog/app/map.rb
@@ -0,0 +1,1025 @@
+$collisions = [
+ [326, 463, 64, 64],
+ [274, 462, 64, 64],
+ [326, 413, 64, 64],
+ [275, 412, 64, 64],
+ [124, 651, 64, 64],
+ [72, 651, 64, 64],
+ [124, 600, 64, 64],
+ [69, 599, 64, 64],
+ [501, 997, 64, 64],
+ [476, 995, 64, 64],
+ [3224, 2057, 64, 64],
+ [3224, 1994, 64, 64],
+ [3225, 1932, 64, 64],
+ [3225, 1870, 64, 64],
+ [3226, 1806, 64, 64],
+ [3224, 1744, 64, 64],
+ [3225, 1689, 64, 64],
+ [3226, 1660, 64, 64],
+ [3161, 1658, 64, 64],
+ [3097, 1660, 64, 64],
+ [3033, 1658, 64, 64],
+ [2969, 1658, 64, 64],
+ [2904, 1658, 64, 64],
+ [2839, 1657, 64, 64],
+ [2773, 1657, 64, 64],
+ [2709, 1658, 64, 64],
+ [2643, 1657, 64, 64],
+ [2577, 1657, 64, 64],
+ [2509, 1658, 64, 64],
+ [2440, 1658, 64, 64],
+ [2371, 1658, 64, 64],
+ [2301, 1659, 64, 64],
+ [2230, 1659, 64, 64],
+ [2159, 1659, 64, 64],
+ [2092, 1660, 64, 64],
+ [2025, 1661, 64, 64],
+ [1958, 1660, 64, 64],
+ [1888, 1659, 64, 64],
+ [1817, 1657, 64, 64],
+ [1745, 1656, 64, 64],
+ [1673, 1658, 64, 64],
+ [1605, 1660, 64, 64],
+ [1536, 1658, 64, 64],
+ [1465, 1660, 64, 64],
+ [1386, 1960, 64, 64],
+ [1384, 1908, 64, 64],
+ [1387, 1862, 64, 64],
+ [1326, 1863, 64, 64],
+ [1302, 1862, 64, 64],
+ [1119, 1906, 64, 64],
+ [1057, 1905, 64, 64],
+ [994, 1905, 64, 64],
+ [937, 1904, 64, 64],
+ [896, 1904, 64, 64],
+ [1001, 1845, 64, 64],
+ [1003, 1780, 64, 64],
+ [1003, 1718, 64, 64],
+ [692, 1958, 64, 64],
+ [691, 1900, 64, 64],
+ [774, 1861, 64, 64],
+ [712, 1861, 64, 64],
+ [691, 1863, 64, 64],
+ [325, 2133, 64, 64],
+ [275, 2134, 64, 64],
+ [326, 2082, 64, 64],
+ [275, 2082, 64, 64],
+ [124, 2321, 64, 64],
+ [71, 2320, 64, 64],
+ [123, 2267, 64, 64],
+ [71, 2268, 64, 64],
+ [2354, 1859, 64, 64],
+ [2292, 1859, 64, 64],
+ [2231, 1857, 64, 64],
+ [2198, 1858, 64, 64],
+ [2353, 1802, 64, 64],
+ [2296, 1798, 64, 64],
+ [2233, 1797, 64, 64],
+ [2200, 1797, 64, 64],
+ [2352, 1742, 64, 64],
+ [2288, 1741, 64, 64],
+ [2230, 1743, 64, 64],
+ [2196, 1743, 64, 64],
+ [1736, 460, 64, 64],
+ [1735, 400, 64, 64],
+ [1736, 339, 64, 64],
+ [1736, 275, 64, 64],
+ [1738, 210, 64, 64],
+ [1735, 145, 64, 64],
+ [1735, 87, 64, 64],
+ [1736, 51, 64, 64],
+ [539, 289, 64, 64],
+ [541, 228, 64, 64],
+ [626, 191, 64, 64],
+ [572, 192, 64, 64],
+ [540, 193, 64, 64],
+ [965, 233, 64, 64],
+ [904, 234, 64, 64],
+ [840, 234, 64, 64],
+ [779, 234, 64, 64],
+ [745, 236, 64, 64],
+ [851, 169, 64, 64],
+ [849, 108, 64, 64],
+ [852, 50, 64, 64],
+ [1237, 289, 64, 64],
+ [1236, 228, 64, 64],
+ [1238, 197, 64, 64],
+ [1181, 192, 64, 64],
+ [1152, 192, 64, 64],
+ [1443, 605, 64, 64],
+ [1419, 606, 64, 64],
+ [1069, 925, 64, 64],
+ [1068, 902, 64, 64],
+ [1024, 927, 64, 64],
+ [1017, 897, 64, 64],
+ [963, 926, 64, 64],
+ [958, 898, 64, 64],
+ [911, 928, 64, 64],
+ [911, 896, 64, 64],
+ [2132, 803, 64, 64],
+ [2081, 803, 64, 64],
+ [2131, 752, 64, 64],
+ [2077, 751, 64, 64],
+ [2615, 649, 64, 64],
+ [2564, 651, 64, 64],
+ [2533, 650, 64, 64],
+ [2027, 156, 64, 64],
+ [1968, 155, 64, 64],
+ [1907, 153, 64, 64],
+ [1873, 155, 64, 64],
+ [2025, 95, 64, 64],
+ [1953, 98, 64, 64],
+ [1894, 100, 64, 64],
+ [1870, 100, 64, 64],
+ [2029, 45, 64, 64],
+ [1971, 48, 64, 64],
+ [1915, 47, 64, 64],
+ [1873, 47, 64, 64],
+ [3956, 288, 64, 64],
+ [3954, 234, 64, 64],
+ [4042, 190, 64, 64],
+ [3990, 190, 64, 64],
+ [3958, 195, 64, 64],
+ [3422, 709, 64, 64],
+ [3425, 686, 64, 64],
+ [3368, 709, 64, 64],
+ [3364, 683, 64, 64],
+ [3312, 711, 64, 64],
+ [3307, 684, 64, 64],
+ [3266, 712, 64, 64],
+ [3269, 681, 64, 64],
+ [4384, 236, 64, 64],
+ [4320, 234, 64, 64],
+ [4257, 235, 64, 64],
+ [4192, 234, 64, 64],
+ [4162, 234, 64, 64],
+ [4269, 171, 64, 64],
+ [4267, 111, 64, 64],
+ [4266, 52, 64, 64],
+ [4580, 458, 64, 64],
+ [4582, 396, 64, 64],
+ [4582, 335, 64, 64],
+ [4581, 275, 64, 64],
+ [4581, 215, 64, 64],
+ [4581, 152, 64, 64],
+ [4582, 89, 64, 64],
+ [4583, 51, 64, 64],
+ [4810, 289, 64, 64],
+ [4810, 227, 64, 64],
+ [4895, 189, 64, 64],
+ [4844, 191, 64, 64],
+ [4809, 191, 64, 64],
+ [5235, 233, 64, 64],
+ [5176, 232, 64, 64],
+ [5118, 230, 64, 64],
+ [5060, 232, 64, 64],
+ [5015, 237, 64, 64],
+ [5123, 171, 64, 64],
+ [5123, 114, 64, 64],
+ [5121, 51, 64, 64],
+ [5523, 461, 64, 64],
+ [5123, 42, 64, 64],
+ [5525, 401, 64, 64],
+ [5525, 340, 64, 64],
+ [5526, 273, 64, 64],
+ [5527, 211, 64, 64],
+ [5525, 150, 64, 64],
+ [5527, 84, 64, 64],
+ [5524, 44, 64, 64],
+ [5861, 288, 64, 64],
+ [5861, 229, 64, 64],
+ [5945, 193, 64, 64],
+ [5904, 193, 64, 64],
+ [5856, 194, 64, 64],
+ [6542, 234, 64, 64],
+ [6478, 235, 64, 64],
+ [6413, 238, 64, 64],
+ [6348, 235, 64, 64],
+ [6285, 236, 64, 64],
+ [6222, 235, 64, 64],
+ [6160, 235, 64, 64],
+ [6097, 236, 64, 64],
+ [6069, 237, 64, 64],
+ [6321, 174, 64, 64],
+ [6318, 111, 64, 64],
+ [6320, 49, 64, 64],
+ [6753, 291, 64, 64],
+ [6752, 227, 64, 64],
+ [6753, 192, 64, 64],
+ [6692, 191, 64, 64],
+ [6668, 193, 64, 64],
+ [6336, 604, 64, 64],
+ [6309, 603, 64, 64],
+ [7264, 461, 64, 64],
+ [7264, 395, 64, 64],
+ [7264, 333, 64, 64],
+ [7264, 270, 64, 64],
+ [7265, 207, 64, 64],
+ [7266, 138, 64, 64],
+ [7264, 78, 64, 64],
+ [7266, 48, 64, 64],
+ [7582, 149, 64, 64],
+ [7524, 147, 64, 64],
+ [7461, 146, 64, 64],
+ [7425, 148, 64, 64],
+ [7580, 86, 64, 64],
+ [7582, 41, 64, 64],
+ [7519, 41, 64, 64],
+ [7460, 40, 64, 64],
+ [7427, 96, 64, 64],
+ [7427, 41, 64, 64],
+ [8060, 288, 64, 64],
+ [8059, 226, 64, 64],
+ [8145, 194, 64, 64],
+ [8081, 194, 64, 64],
+ [8058, 195, 64, 64],
+ [8485, 234, 64, 64],
+ [8422, 235, 64, 64],
+ [8360, 235, 64, 64],
+ [8296, 235, 64, 64],
+ [8266, 237, 64, 64],
+ [8371, 173, 64, 64],
+ [8370, 117, 64, 64],
+ [8372, 59, 64, 64],
+ [8372, 51, 64, 64],
+ [9147, 192, 64, 64],
+ [9063, 287, 64, 64],
+ [9064, 225, 64, 64],
+ [9085, 193, 64, 64],
+ [9063, 194, 64, 64],
+ [9492, 234, 64, 64],
+ [9428, 234, 64, 64],
+ [9365, 235, 64, 64],
+ [9302, 235, 64, 64],
+ [9270, 237, 64, 64],
+ [9374, 172, 64, 64],
+ [9376, 109, 64, 64],
+ [9377, 48, 64, 64],
+ [9545, 1060, 64, 64],
+ [9482, 1062, 64, 64],
+ [9423, 1062, 64, 64],
+ [9387, 1062, 64, 64],
+ [9541, 999, 64, 64],
+ [9542, 953, 64, 64],
+ [9478, 953, 64, 64],
+ [9388, 999, 64, 64],
+ [9414, 953, 64, 64],
+ [9389, 953, 64, 64],
+ [9294, 1194, 64, 64],
+ [9245, 1195, 64, 64],
+ [9297, 1143, 64, 64],
+ [9245, 1144, 64, 64],
+ [5575, 1781, 64, 64],
+ [5574, 1753, 64, 64],
+ [5522, 1782, 64, 64],
+ [5518, 1753, 64, 64],
+ [5472, 1783, 64, 64],
+ [5471, 1751, 64, 64],
+ [5419, 1781, 64, 64],
+ [5421, 1749, 64, 64],
+ [500, 3207, 64, 64],
+ [477, 3205, 64, 64],
+ [1282, 3214, 64, 64],
+ [1221, 3214, 64, 64],
+ [1188, 3215, 64, 64],
+ [1345, 3103, 64, 64],
+ [1288, 3103, 64, 64],
+ [1231, 3104, 64, 64],
+ [1190, 3153, 64, 64],
+ [1189, 3105, 64, 64],
+ [2255, 3508, 64, 64],
+ [2206, 3510, 64, 64],
+ [2254, 3458, 64, 64],
+ [2202, 3458, 64, 64],
+ [2754, 2930, 64, 64],
+ [2726, 2932, 64, 64],
+ [3408, 2874, 64, 64],
+ [3407, 2849, 64, 64],
+ [3345, 2872, 64, 64],
+ [3342, 2847, 64, 64],
+ [3284, 2874, 64, 64],
+ [3284, 2848, 64, 64],
+ [3248, 2878, 64, 64],
+ [3252, 2848, 64, 64],
+ [3953, 3274, 64, 64],
+ [3899, 3277, 64, 64],
+ [3951, 3222, 64, 64],
+ [3900, 3222, 64, 64],
+ [4310, 2968, 64, 64],
+ [4246, 2969, 64, 64],
+ [4183, 2965, 64, 64],
+ [4153, 2967, 64, 64],
+ [4311, 2910, 64, 64],
+ [4308, 2856, 64, 64],
+ [4251, 2855, 64, 64],
+ [4197, 2857, 64, 64],
+ [5466, 3184, 64, 64],
+ [5466, 3158, 64, 64],
+ [5404, 3184, 64, 64],
+ [5404, 3156, 64, 64],
+ [5343, 3185, 64, 64],
+ [5342, 3156, 64, 64],
+ [5308, 3185, 64, 64],
+ [5307, 3154, 64, 64],
+ [6163, 2950, 64, 64],
+ [6111, 2952, 64, 64],
+ [6164, 2898, 64, 64],
+ [6113, 2897, 64, 64],
+ [7725, 3156, 64, 64],
+ [7661, 3157, 64, 64],
+ [7598, 3157, 64, 64],
+ [7533, 3156, 64, 64],
+ [7468, 3156, 64, 64],
+ [7401, 3156, 64, 64],
+ [7335, 3157, 64, 64],
+ [7270, 3157, 64, 64],
+ [7208, 3157, 64, 64],
+ [7146, 3157, 64, 64],
+ [7134, 3159, 64, 64],
+ [6685, 3726, 64, 64],
+ [6685, 3663, 64, 64],
+ [6683, 3602, 64, 64],
+ [6679, 3538, 64, 64],
+ [6680, 3474, 64, 64],
+ [6682, 3413, 64, 64],
+ [6681, 3347, 64, 64],
+ [6681, 3287, 64, 64],
+ [6682, 3223, 64, 64],
+ [6683, 3161, 64, 64],
+ [6682, 3102, 64, 64],
+ [6684, 3042, 64, 64],
+ [6685, 2980, 64, 64],
+ [6685, 2920, 64, 64],
+ [6683, 2859, 64, 64],
+ [6684, 2801, 64, 64],
+ [6686, 2743, 64, 64],
+ [6683, 2683, 64, 64],
+ [6681, 2622, 64, 64],
+ [6682, 2559, 64, 64],
+ [6683, 2498, 64, 64],
+ [6685, 2434, 64, 64],
+ [6683, 2371, 64, 64],
+ [6683, 2306, 64, 64],
+ [6684, 2242, 64, 64],
+ [6683, 2177, 64, 64],
+ [6683, 2112, 64, 64],
+ [6683, 2049, 64, 64],
+ [6683, 1985, 64, 64],
+ [6682, 1923, 64, 64],
+ [6683, 1860, 64, 64],
+ [6685, 1797, 64, 64],
+ [6684, 1735, 64, 64],
+ [6685, 1724, 64, 64],
+ [7088, 1967, 64, 64],
+ [7026, 1966, 64, 64],
+ [6964, 1967, 64, 64],
+ [6900, 1965, 64, 64],
+ [6869, 1969, 64, 64],
+ [6972, 1904, 64, 64],
+ [6974, 1840, 64, 64],
+ [6971, 1776, 64, 64],
+ [6971, 1716, 64, 64],
+ [7168, 1979, 64, 64],
+ [7170, 1919, 64, 64],
+ [7169, 1882, 64, 64],
+ [7115, 1880, 64, 64],
+ [7086, 1881, 64, 64],
+ [7725, 1837, 64, 64],
+ [7724, 1776, 64, 64],
+ [7724, 1728, 64, 64],
+ [7661, 1727, 64, 64],
+ [7603, 1728, 64, 64],
+ [7571, 1837, 64, 64],
+ [7570, 1774, 64, 64],
+ [7572, 1725, 64, 64],
+ [7859, 2134, 64, 64],
+ [7858, 2070, 64, 64],
+ [7858, 2008, 64, 64],
+ [7860, 1942, 64, 64],
+ [7856, 1878, 64, 64],
+ [7860, 1813, 64, 64],
+ [7859, 1750, 64, 64],
+ [7856, 1724, 64, 64],
+ [8155, 1837, 64, 64],
+ [8092, 1839, 64, 64],
+ [8032, 1838, 64, 64],
+ [7999, 1839, 64, 64],
+ [8153, 1773, 64, 64],
+ [8154, 1731, 64, 64],
+ [8090, 1730, 64, 64],
+ [8035, 1732, 64, 64],
+ [8003, 1776, 64, 64],
+ [8003, 1730, 64, 64],
+ [8421, 1978, 64, 64],
+ [8420, 1917, 64, 64],
+ [8505, 1878, 64, 64],
+ [8443, 1881, 64, 64],
+ [8420, 1882, 64, 64],
+ [8847, 1908, 64, 64],
+ [8783, 1908, 64, 64],
+ [8718, 1910, 64, 64],
+ [8654, 1910, 64, 64],
+ [8628, 1911, 64, 64],
+ [8729, 1847, 64, 64],
+ [8731, 1781, 64, 64],
+ [8731, 1721, 64, 64],
+ [9058, 2135, 64, 64],
+ [9056, 2073, 64, 64],
+ [9058, 2006, 64, 64],
+ [9057, 1939, 64, 64],
+ [9058, 1876, 64, 64],
+ [9056, 1810, 64, 64],
+ [9059, 1745, 64, 64],
+ [9060, 1722, 64, 64],
+ [9273, 1977, 64, 64],
+ [9273, 1912, 64, 64],
+ [9358, 1883, 64, 64],
+ [9298, 1881, 64, 64],
+ [9270, 1883, 64, 64],
+ [9699, 1910, 64, 64],
+ [9637, 1910, 64, 64],
+ [9576, 1910, 64, 64],
+ [9512, 1911, 64, 64],
+ [9477, 1912, 64, 64],
+ [9584, 1846, 64, 64],
+ [9585, 1783, 64, 64],
+ [9586, 1719, 64, 64],
+ [8320, 2788, 64, 64],
+ [8256, 2789, 64, 64],
+ [8192, 2789, 64, 64],
+ [8180, 2789, 64, 64],
+ [8319, 2730, 64, 64],
+ [8319, 2671, 64, 64],
+ [8319, 2639, 64, 64],
+ [8259, 2639, 64, 64],
+ [8202, 2639, 64, 64],
+ [8179, 2727, 64, 64],
+ [8178, 2665, 64, 64],
+ [8177, 2636, 64, 64],
+ [9360, 3138, 64, 64],
+ [9296, 3137, 64, 64],
+ [9235, 3139, 64, 64],
+ [9174, 3139, 64, 64],
+ [9113, 3138, 64, 64],
+ [9050, 3138, 64, 64],
+ [8988, 3138, 64, 64],
+ [8925, 3138, 64, 64],
+ [8860, 3136, 64, 64],
+ [8797, 3136, 64, 64],
+ [8770, 3138, 64, 64],
+ [8827, 4171, 64, 64],
+ [8827, 4107, 64, 64],
+ [8827, 4043, 64, 64],
+ [8827, 3978, 64, 64],
+ [8825, 3914, 64, 64],
+ [8824, 3858, 64, 64],
+ [9635, 4234, 64, 64],
+ [9584, 4235, 64, 64],
+ [9634, 4187, 64, 64],
+ [9582, 4183, 64, 64],
+ [9402, 5114, 64, 64],
+ [9402, 5087, 64, 64],
+ [9347, 5113, 64, 64],
+ [9345, 5086, 64, 64],
+ [9287, 5114, 64, 64],
+ [9285, 5085, 64, 64],
+ [9245, 5114, 64, 64],
+ [9244, 5086, 64, 64],
+ [9336, 5445, 64, 64],
+ [9285, 5445, 64, 64],
+ [9337, 5395, 64, 64],
+ [9283, 5393, 64, 64],
+ [8884, 4968, 64, 64],
+ [8884, 4939, 64, 64],
+ [8822, 4967, 64, 64],
+ [8823, 4940, 64, 64],
+ [8765, 4967, 64, 64],
+ [8762, 4937, 64, 64],
+ [8726, 4969, 64, 64],
+ [8727, 4939, 64, 64],
+ [7946, 5248, 64, 64],
+ [7945, 5220, 64, 64],
+ [7887, 5248, 64, 64],
+ [7886, 5219, 64, 64],
+ [7830, 5248, 64, 64],
+ [7827, 5218, 64, 64],
+ [7781, 5248, 64, 64],
+ [7781, 5216, 64, 64],
+ [6648, 4762, 64, 64],
+ [6621, 4761, 64, 64],
+ [5011, 4446, 64, 64],
+ [4982, 4444, 64, 64],
+ [4146, 4641, 64, 64],
+ [4092, 4643, 64, 64],
+ [4145, 4589, 64, 64],
+ [4091, 4590, 64, 64],
+ [4139, 4497, 64, 64],
+ [4135, 4437, 64, 64],
+ [4135, 4383, 64, 64],
+ [4078, 4495, 64, 64],
+ [4014, 4494, 64, 64],
+ [3979, 4496, 64, 64],
+ [4074, 4384, 64, 64],
+ [4015, 4381, 64, 64],
+ [3980, 4433, 64, 64],
+ [3981, 4384, 64, 64],
+ [3276, 4279, 64, 64],
+ [3275, 4218, 64, 64],
+ [3276, 4170, 64, 64],
+ [3211, 4164, 64, 64],
+ [3213, 4280, 64, 64],
+ [3156, 4278, 64, 64],
+ [3120, 4278, 64, 64],
+ [3151, 4163, 64, 64],
+ [3120, 4216, 64, 64],
+ [3120, 4161, 64, 64],
+ [1536, 4171, 64, 64],
+ [1536, 4110, 64, 64],
+ [1535, 4051, 64, 64],
+ [1536, 3991, 64, 64],
+ [1536, 3928, 64, 64],
+ [1536, 3863, 64, 64],
+ [1078, 4605, 64, 64],
+ [1076, 4577, 64, 64],
+ [1018, 4604, 64, 64],
+ [1018, 4575, 64, 64],
+ [957, 4606, 64, 64],
+ [960, 4575, 64, 64],
+ [918, 4602, 64, 64],
+ [918, 4580, 64, 64],
+ [394, 4164, 64, 64],
+ [335, 4163, 64, 64],
+ [274, 4161, 64, 64],
+ [236, 4163, 64, 64],
+ [394, 4140, 64, 64],
+ [329, 4139, 64, 64],
+ [268, 4139, 64, 64],
+ [239, 4139, 64, 64],
+ [4326, 5073, 64, 64],
+ [4324, 5042, 64, 64],
+ [4265, 5074, 64, 64],
+ [4263, 5042, 64, 64],
+ [4214, 5072, 64, 64],
+ [4211, 5043, 64, 64],
+ [4166, 5073, 64, 64],
+ [4164, 5041, 64, 64],
+ [4844, 5216, 64, 64],
+ [4844, 5189, 64, 64],
+ [4785, 5217, 64, 64],
+ [4790, 5187, 64, 64],
+ [4726, 5219, 64, 64],
+ [4728, 5185, 64, 64],
+ [4681, 5218, 64, 64],
+ [4684, 5186, 64, 64],
+ [4789, 4926, 64, 64],
+ [4734, 4928, 64, 64],
+ [4787, 4876, 64, 64],
+ [4738, 4874, 64, 64],
+ [4775, 5548, 64, 64],
+ [4775, 5495, 64, 64],
+ [4723, 5550, 64, 64],
+ [4725, 5494, 64, 64],
+ [1360, 5269, 64, 64],
+ [1362, 5218, 64, 64],
+ [1315, 5266, 64, 64],
+ [1282, 5266, 64, 64],
+ [1246, 5311, 64, 64],
+ [1190, 5312, 64, 64],
+ [1136, 5310, 64, 64],
+ [1121, 5427, 64, 64],
+ [1121, 5370, 64, 64],
+ [1074, 5427, 64, 64],
+ [1064, 5423, 64, 64],
+ [1052, 5417, 64, 64],
+ [1050, 5368, 64, 64],
+ [1008, 5314, 64, 64],
+ [997, 5307, 64, 64],
+ [977, 5299, 64, 64],
+ [976, 5248, 64, 64],
+ [825, 5267, 64, 64],
+ [826, 5213, 64, 64],
+ [776, 5267, 64, 64],
+ [768, 5261, 64, 64],
+ [755, 5256, 64, 64],
+ [753, 5209, 64, 64],
+ [1299, 5206, 64, 64],
+ [1238, 5204, 64, 64],
+ [1178, 5203, 64, 64],
+ [1124, 5204, 64, 64],
+ [1065, 5206, 64, 64],
+ [1008, 5203, 64, 64],
+ [977, 5214, 64, 64],
+ [410, 5313, 64, 64],
+ [407, 5249, 64, 64],
+ [411, 5225, 64, 64],
+ [397, 5217, 64, 64],
+ [378, 5209, 64, 64],
+ [358, 5312, 64, 64],
+ [287, 5427, 64, 64],
+ [286, 5364, 64, 64],
+ [300, 5313, 64, 64],
+ [242, 5427, 64, 64],
+ [229, 5420, 64, 64],
+ [217, 5416, 64, 64],
+ [215, 5364, 64, 64],
+ [174, 5311, 64, 64],
+ [165, 5308, 64, 64],
+ [139, 5300, 64, 64],
+ [141, 5236, 64, 64],
+ [141, 5211, 64, 64],
+ [315, 5208, 64, 64],
+ [251, 5208, 64, 64],
+ [211, 5211, 64, 64],
+ [8050, 4060, 64, 64],
+ [7992, 4060, 64, 64],
+ [7929, 4060, 64, 64],
+ [7866, 4061, 64, 64],
+ [7828, 4063, 64, 64],
+ [7934, 4001, 64, 64],
+ [7935, 3936, 64, 64],
+ [7935, 3875, 64, 64],
+ [7622, 4111, 64, 64],
+ [7623, 4049, 64, 64],
+ [7707, 4018, 64, 64],
+ [7663, 4019, 64, 64],
+ [7623, 4017, 64, 64],
+ [7193, 4060, 64, 64],
+ [7131, 4059, 64, 64],
+ [7070, 4057, 64, 64],
+ [7008, 4060, 64, 64],
+ [6977, 4060, 64, 64],
+ [7080, 3998, 64, 64],
+ [7081, 3935, 64, 64],
+ [7080, 3873, 64, 64],
+ [6855, 4019, 64, 64],
+ [6790, 4018, 64, 64],
+ [6770, 4114, 64, 64],
+ [6770, 4060, 64, 64],
+ [6768, 4013, 64, 64],
+ [6345, 4060, 64, 64],
+ [6284, 4062, 64, 64],
+ [6222, 4061, 64, 64],
+ [6166, 4061, 64, 64],
+ [6124, 4066, 64, 64],
+ [6226, 3995, 64, 64],
+ [6226, 3933, 64, 64],
+ [6228, 3868, 64, 64],
+ [5916, 4113, 64, 64],
+ [5918, 4052, 64, 64],
+ [6001, 4018, 64, 64],
+ [5941, 4019, 64, 64],
+ [5918, 4020, 64, 64],
+ [5501, 4059, 64, 64],
+ [5439, 4061, 64, 64],
+ [5376, 4059, 64, 64],
+ [5312, 4058, 64, 64],
+ [5285, 4062, 64, 64],
+ [5388, 3999, 64, 64],
+ [5385, 3941, 64, 64],
+ [5384, 3874, 64, 64],
+ [5075, 4112, 64, 64],
+ [5074, 4051, 64, 64],
+ [5158, 4018, 64, 64],
+ [5095, 4020, 64, 64],
+ [5073, 4018, 64, 64],
+ [4549, 3998, 64, 64],
+ [4393, 3996, 64, 64],
+ [4547, 3938, 64, 64],
+ [4547, 3886, 64, 64],
+ [4488, 3885, 64, 64],
+ [4427, 3885, 64, 64],
+ [4395, 3938, 64, 64],
+ [4395, 3885, 64, 64],
+ [0, 0, 64, 64],
+ [0, 1670, 64, 64],
+ [6691, 1653, 64, 64],
+ [1521, 3792, 64, 64],
+ [0, 5137, 64, 64],
+ [0, 0, 64, 64],
+ [0, 1670, 64, 64],
+ [6691, 1653, 64, 64],
+ [1521, 3792, 64, 64],
+ [0, 5137, 64, 64],
+ [1215, 2421, 64, 64],
+ [1214, 2360, 64, 64],
+ [1211, 2300, 64, 64],
+ [1211, 2291, 64, 64],
+ [1158, 2420, 64, 64],
+ [1156, 2358, 64, 64],
+ [1149, 2291, 64, 64],
+ [1095, 2420, 64, 64],
+ [1030, 2418, 64, 64],
+ [966, 2419, 64, 64],
+ [903, 2419, 64, 64],
+ [852, 2419, 64, 64],
+ [1087, 2291, 64, 64],
+ [1023, 2291, 64, 64],
+ [960, 2291, 64, 64],
+ [896, 2292, 64, 64],
+ [854, 2355, 64, 64],
+ [854, 2292, 64, 64],
+ [675, 3017, 64, 64],
+ [622, 3017, 64, 64],
+ [676, 2965, 64, 64],
+ [622, 2965, 64, 64],
+ [1560, 3212, 64, 64],
+ [1496, 3212, 64, 64],
+ [1430, 3211, 64, 64],
+ [1346, 3214, 64, 64],
+ [1410, 3213, 64, 64],
+ [1560, 3147, 64, 64],
+ [1559, 3105, 64, 64],
+ [1496, 3105, 64, 64],
+ [1442, 3105, 64, 64],
+ [1412, 3106, 64, 64],
+ [918, 4163, 64, 64],
+ [854, 4161, 64, 64],
+ [792, 4160, 64, 64],
+ [729, 4159, 64, 64],
+ [666, 4158, 64, 64],
+ [601, 4158, 64, 64],
+ [537, 4156, 64, 64],
+ [918, 4137, 64, 64],
+ [854, 4137, 64, 64],
+ [789, 4136, 64, 64],
+ [726, 4137, 64, 64],
+ [661, 4137, 64, 64],
+ [599, 4139, 64, 64],
+ [538, 4137, 64, 64],
+ [5378, 4254, 64, 64],
+ [5440, 4204, 64, 64],
+ [5405, 4214, 64, 64],
+ [5350, 4254, 64, 64],
+ [5439, 4177, 64, 64],
+ [5413, 4173, 64, 64],
+ [5399, 4128, 64, 64],
+ [5352, 4200, 64, 64],
+ [5352, 4158, 64, 64],
+ [5392, 4130, 64, 64],
+ [6216, 4251, 64, 64],
+ [6190, 4251, 64, 64],
+ [6279, 4200, 64, 64],
+ [6262, 4205, 64, 64],
+ [6233, 4214, 64, 64],
+ [6280, 4172, 64, 64],
+ [6256, 4169, 64, 64],
+ [6239, 4128, 64, 64],
+ [6231, 4128, 64, 64],
+ [6191, 4195, 64, 64],
+ [6190, 4158, 64, 64],
+ [7072, 4250, 64, 64],
+ [7046, 4250, 64, 64],
+ [7133, 4202, 64, 64],
+ [7107, 4209, 64, 64],
+ [7086, 4214, 64, 64],
+ [7133, 4173, 64, 64],
+ [7108, 4169, 64, 64],
+ [7092, 4127, 64, 64],
+ [7084, 4128, 64, 64],
+ [7047, 4191, 64, 64],
+ [7047, 4156, 64, 64],
+ [7926, 4252, 64, 64],
+ [7900, 4253, 64, 64],
+ [7987, 4202, 64, 64],
+ [7965, 4209, 64, 64],
+ [7942, 4216, 64, 64],
+ [7989, 4174, 64, 64],
+ [7970, 4170, 64, 64],
+ [7949, 4126, 64, 64],
+ [7901, 4196, 64, 64],
+ [7900, 4159, 64, 64],
+ [7941, 4130, 64, 64],
+ [2847, 379, 64, 64],
+ [2825, 380, 64, 64],
+ [2845, 317, 64, 64],
+ [2829, 316, 64, 64],
+ [2845, 255, 64, 64],
+ [2830, 257, 64, 64],
+ [2845, 202, 64, 64],
+ [2829, 198, 64, 64],
+ [2770, 169, 64, 64],
+ [2708, 170, 64, 64],
+ [2646, 171, 64, 64],
+ [2582, 171, 64, 64],
+ [2518, 171, 64, 64],
+ [2454, 171, 64, 64],
+ [2391, 172, 64, 64],
+ [2332, 379, 64, 64],
+ [2315, 379, 64, 64],
+ [2334, 316, 64, 64],
+ [2315, 317, 64, 64],
+ [2332, 254, 64, 64],
+ [2314, 254, 64, 64],
+ [2335, 192, 64, 64],
+ [2311, 192, 64, 64],
+ [2846, 142, 64, 64],
+ [2784, 140, 64, 64],
+ [2846, 79, 64, 64],
+ [2847, 41, 64, 64],
+ [2783, 80, 64, 64],
+ [2790, 39, 64, 64],
+ [2727, 41, 64, 64],
+ [2665, 43, 64, 64],
+ [2605, 43, 64, 64],
+ [2543, 44, 64, 64],
+ [2480, 45, 64, 64],
+ [2419, 45, 64, 64],
+ [2357, 44, 64, 64],
+ [2313, 129, 64, 64],
+ [2313, 70, 64, 64],
+ [2314, 40, 64, 64],
+ [2517, 2385, 64, 64],
+ [2452, 2385, 64, 64],
+ [2390, 2386, 64, 64],
+ [2328, 2386, 64, 64],
+ [2264, 2386, 64, 64],
+ [2200, 2386, 64, 64],
+ [2137, 2387, 64, 64],
+ [2071, 2385, 64, 64],
+ [2016, 2389, 64, 64],
+ [2517, 2341, 64, 64],
+ [2518, 2316, 64, 64],
+ [2456, 2316, 64, 64],
+ [2393, 2316, 64, 64],
+ [2328, 2317, 64, 64],
+ [2264, 2316, 64, 64],
+ [2207, 2318, 64, 64],
+ [2144, 2317, 64, 64],
+ [2081, 2316, 64, 64],
+ [2015, 2342, 64, 64],
+ [2016, 2315, 64, 64],
+ [869, 3709, 64, 64],
+ [819, 3710, 64, 64],
+ [869, 3658, 64, 64],
+ [820, 3658, 64, 64],
+ [0, 0, 64, 64],
+ [0, 1670, 64, 64],
+ [6691, 1653, 64, 64],
+ [1521, 3792, 64, 64],
+ [0, 5137, 64, 64],
+ [3898, 2400, 64, 64],
+ [3835, 2400, 64, 64],
+ [3771, 2400, 64, 64],
+ [3708, 2401, 64, 64],
+ [3646, 2401, 64, 64],
+ [3587, 2401, 64, 64],
+ [3530, 2401, 64, 64],
+ [3897, 2340, 64, 64],
+ [3897, 2295, 64, 64],
+ [3834, 2296, 64, 64],
+ [3773, 2295, 64, 64],
+ [3710, 2296, 64, 64],
+ [3656, 2295, 64, 64],
+ [3593, 2294, 64, 64],
+ [3527, 2339, 64, 64],
+ [3531, 2293, 64, 64],
+ [4152, 2903, 64, 64],
+ [4155, 2858, 64, 64],
+ [3942, 1306, 64, 64],
+ [3942, 1279, 64, 64],
+ [3879, 1306, 64, 64],
+ [3881, 1278, 64, 64],
+ [3819, 1305, 64, 64],
+ [3819, 1277, 64, 64],
+ [3756, 1306, 64, 64],
+ [3756, 1277, 64, 64],
+ [3694, 1306, 64, 64],
+ [3695, 1277, 64, 64],
+ [3631, 1306, 64, 64],
+ [3632, 1278, 64, 64],
+ [3565, 1306, 64, 64],
+ [3567, 1279, 64, 64],
+ [4432, 1165, 64, 64],
+ [4408, 1163, 64, 64],
+ [5123, 1003, 64, 64],
+ [5065, 1002, 64, 64],
+ [5042, 1002, 64, 64],
+ [6020, 1780, 64, 64],
+ [6020, 1756, 64, 64],
+ [5959, 1780, 64, 64],
+ [5959, 1752, 64, 64],
+ [5897, 1779, 64, 64],
+ [5899, 1752, 64, 64],
+ [5836, 1779, 64, 64],
+ [5836, 1751, 64, 64],
+ [5776, 1780, 64, 64],
+ [5776, 1754, 64, 64],
+ [5717, 1780, 64, 64],
+ [5716, 1752, 64, 64],
+ [5658, 1781, 64, 64],
+ [5658, 1755, 64, 64],
+ [5640, 1781, 64, 64],
+ [5640, 1754, 64, 64],
+ [5832, 2095, 64, 64],
+ [5782, 2093, 64, 64],
+ [5832, 2044, 64, 64],
+ [5777, 2043, 64, 64],
+ [4847, 2577, 64, 64],
+ [4795, 2577, 64, 64],
+ [4846, 2526, 64, 64],
+ [4794, 2526, 64, 64],
+ [8390, 923, 64, 64],
+ [8363, 922, 64, 64],
+ [7585, 1084, 64, 64],
+ [7582, 1058, 64, 64],
+ [7525, 1084, 64, 64],
+ [7524, 1056, 64, 64],
+ [7478, 1085, 64, 64],
+ [7476, 1055, 64, 64],
+ [7421, 1086, 64, 64],
+ [7421, 1052, 64, 64],
+ [7362, 1085, 64, 64],
+ [7361, 1053, 64, 64],
+ [7307, 1087, 64, 64],
+ [7307, 1054, 64, 64],
+ [7258, 1086, 64, 64],
+ [7255, 1058, 64, 64],
+ [7203, 1083, 64, 64],
+ [7203, 1055, 64, 64],
+ [7161, 1085, 64, 64],
+ [7158, 1057, 64, 64],
+ [7100, 1083, 64, 64],
+ [7099, 1058, 64, 64],
+ [7038, 1082, 64, 64],
+ [7038, 1058, 64, 64],
+ [6982, 1083, 64, 64],
+ [6984, 1057, 64, 64],
+ [0, 0, 64, 64],
+ [0, 1670, 64, 64],
+ [6691, 1653, 64, 64],
+ [1521, 3792, 64, 64],
+ [0, 5137, 64, 64],
+ [0, 0, 64, 64],
+ [0, 1670, 64, 64],
+ [6691, 1653, 64, 64],
+ [1521, 3792, 64, 64],
+ [0, 5137, 64, 64],
+ [0, 0, 64, 64],
+ [0, 1670, 64, 64],
+ [6691, 1653, 64, 64],
+ [1521, 3792, 64, 64],
+ [0, 5137, 64, 64],
+ [8346, 424, 64, 64],
+ [8407, 376, 64, 64],
+ [8375, 386, 64, 64],
+ [8407, 347, 64, 64],
+ [8388, 343, 64, 64],
+ [8320, 423, 64, 64],
+ [8319, 363, 64, 64],
+ [8368, 303, 64, 64],
+ [8359, 303, 64, 64],
+ [8318, 330, 64, 64],
+ [9369, 425, 64, 64],
+ [9340, 425, 64, 64],
+ [9431, 376, 64, 64],
+ [9414, 382, 64, 64],
+ [9387, 391, 64, 64],
+ [9431, 349, 64, 64],
+ [9412, 344, 64, 64],
+ [9392, 305, 64, 64],
+ [9339, 365, 64, 64],
+ [9341, 333, 64, 64],
+ [9384, 301, 64, 64],
+ [7673, 1896, 64, 64],
+ [7642, 1834, 64, 64],
+ [7646, 1901, 64, 64],
+ [4500, 4054, 64, 64],
+ [4476, 4055, 64, 64],
+ [4459, 3997, 64, 64],
+ [76, 5215, 64, 64],
+ [39, 5217, 64, 64],
+]
+
+$mugs = [
+ [85, 87, 39, 43, "sprites/square-orange.png"],
+ [958, 1967, 39, 43, "sprites/square-orange.png"],
+ [2537, 1734, 39, 43, "sprites/square-orange.png"],
+ [3755, 2464, 39, 43, "sprites/square-orange.png"],
+ [1548, 3273, 39, 43, "sprites/square-orange.png"],
+ [2050, 220, 39, 43, "sprites/square-orange.png"],
+ [854, 297, 39, 43, "sprites/square-orange.png"],
+ [343, 526, 39, 43, "sprites/square-orange.png"],
+ [3454, 772, 39, 43, "sprites/square-orange.png"],
+ [5041, 298, 39, 43, "sprites/square-orange.png"],
+ [6089, 300, 39, 43, "sprites/square-orange.png"],
+ [6518, 295, 39, 43, "sprites/square-orange.png"],
+ [7661, 47, 39, 43, "sprites/square-orange.png"],
+ [9392, 1125, 39, 43, "sprites/square-orange.png"],
+ [7298, 1152, 39, 43, "sprites/square-orange.png"],
+ [5816, 1843, 39, 43, "sprites/square-orange.png"],
+ [876, 3772, 39, 43, "sprites/square-orange.png"],
+ [1029, 4667, 39, 43, "sprites/square-orange.png"],
+ [823, 5324, 39, 43, "sprites/square-orange.png"],
+ [3251, 5220, 39, 43, "sprites/square-orange.png"],
+ [4747, 5282, 39, 43, "sprites/square-orange.png"],
+ [9325, 5178, 39, 43, "sprites/square-orange.png"],
+ [9635, 4298, 39, 43, "sprites/square-orange.png"],
+ [7837, 4127, 39, 43, "sprites/square-orange.png"],
+ [8651, 1971, 39, 43, "sprites/square-orange.png"],
+ [6892, 2031, 39, 43, "sprites/square-orange.png"],
+ [4626, 3882, 39, 43, "sprites/square-orange.png"],
+ [4024, 4554, 39, 43, "sprites/square-orange.png"],
+ [3925, 3337, 39, 43, "sprites/square-orange.png"],
+ [5064, 1064, 39, 43, "sprites/square-orange.png"]
+]