summaryrefslogtreecommitdiffhomepage
path: root/samples
diff options
context:
space:
mode:
authorAmir Rajan <[email protected]>2020-07-30 16:45:24 -0500
committerAmir Rajan <[email protected]>2020-07-30 16:58:40 -0500
commiteb8b770e1952af371832f5f31e00dae09d498cf9 (patch)
tree0884e11fedbfa01c7ce9f1e028cb6c43a13d2052 /samples
parent8d000345a3489988e9e86ee9fda9dcc6c70b7012 (diff)
downloaddragonruby-game-toolkit-contrib-eb8b770e1952af371832f5f31e00dae09d498cf9.tar.gz
dragonruby-game-toolkit-contrib-eb8b770e1952af371832f5f31e00dae09d498cf9.zip
OSS synced with 1.12.
Diffstat (limited to 'samples')
-rw-r--r--samples/19_lowrez_jam/app/lowrez.rb159
-rw-r--r--samples/19_lowrez_jam/app/main.rb613
-rw-r--r--samples/19_lowrez_jam/fonts/lowrez.ttfbin0 -> 11248 bytes
-rw-r--r--samples/19_lowrez_jam/sprites/explosion-0.png (renamed from samples/19_lowrez_jam_01_hello_world/sprites/explosion_0.png)bin267 -> 267 bytes
-rw-r--r--samples/19_lowrez_jam/sprites/explosion-1.png (renamed from samples/19_lowrez_jam_01_hello_world/sprites/explosion_1.png)bin4585 -> 4585 bytes
-rw-r--r--samples/19_lowrez_jam/sprites/explosion-2.png (renamed from samples/19_lowrez_jam_01_hello_world/sprites/explosion_2.png)bin4675 -> 4675 bytes
-rw-r--r--samples/19_lowrez_jam/sprites/explosion-3.png (renamed from samples/19_lowrez_jam_01_hello_world/sprites/explosion_3.png)bin4724 -> 4724 bytes
-rw-r--r--samples/19_lowrez_jam/sprites/explosion-4.png (renamed from samples/19_lowrez_jam_01_hello_world/sprites/explosion_4.png)bin4773 -> 4773 bytes
-rw-r--r--samples/19_lowrez_jam/sprites/explosion-5.png (renamed from samples/19_lowrez_jam_01_hello_world/sprites/explosion_5.png)bin4742 -> 4742 bytes
-rw-r--r--samples/19_lowrez_jam/sprites/explosion-6.png (renamed from samples/19_lowrez_jam_01_hello_world/sprites/explosion_6.png)bin4665 -> 4665 bytes
-rw-r--r--samples/19_lowrez_jam/sprites/explosion-sheet.pngbin0 -> 2584 bytes
-rw-r--r--samples/19_lowrez_jam/sprites/lowrez-ship-blue.png (renamed from samples/19_lowrez_jam_03_space_shooter/sprites/ship_blue.png)bin109 -> 109 bytes
-rw-r--r--samples/19_lowrez_jam/sprites/lowrez-ship-red.png (renamed from samples/19_lowrez_jam_03_space_shooter/sprites/ship_red.png)bin104 -> 104 bytes
-rw-r--r--samples/19_lowrez_jam_01_hello_world/app/main.rb192
-rw-r--r--samples/19_lowrez_jam_01_hello_world/dragonruby-gtk-4x4.ttfbin8820 -> 0 bytes
-rw-r--r--samples/19_lowrez_jam_01_hello_world/license-for-sample.txt9
-rw-r--r--samples/19_lowrez_jam_01_hello_world/replay.txt339
-rw-r--r--samples/19_lowrez_jam_02_buttons/app/main.rb219
-rw-r--r--samples/19_lowrez_jam_02_buttons/dragonruby-gtk-4x4.ttfbin8820 -> 0 bytes
-rw-r--r--samples/19_lowrez_jam_02_buttons/license-for-sample.txt9
-rw-r--r--samples/19_lowrez_jam_02_buttons/replay.txt456
-rw-r--r--samples/19_lowrez_jam_02_buttons/sprites/explosion_0.pngbin267 -> 0 bytes
-rw-r--r--samples/19_lowrez_jam_02_buttons/sprites/explosion_1.pngbin4585 -> 0 bytes
-rw-r--r--samples/19_lowrez_jam_02_buttons/sprites/explosion_2.pngbin4675 -> 0 bytes
-rw-r--r--samples/19_lowrez_jam_02_buttons/sprites/explosion_3.pngbin4724 -> 0 bytes
-rw-r--r--samples/19_lowrez_jam_02_buttons/sprites/explosion_4.pngbin4773 -> 0 bytes
-rw-r--r--samples/19_lowrez_jam_02_buttons/sprites/explosion_5.pngbin4742 -> 0 bytes
-rw-r--r--samples/19_lowrez_jam_02_buttons/sprites/explosion_6.pngbin4665 -> 0 bytes
-rw-r--r--samples/19_lowrez_jam_03_space_shooter/app/main.rb295
-rw-r--r--samples/19_lowrez_jam_03_space_shooter/dragonruby-gtk-4x4.ttfbin8820 -> 0 bytes
-rw-r--r--samples/19_lowrez_jam_03_space_shooter/license-for-sample.txt9
-rw-r--r--samples/19_lowrez_jam_03_space_shooter/replay.txt147
-rw-r--r--samples/19_lowrez_jam_03_space_shooter/sprites/blue_bullet.pngbin81 -> 0 bytes
33 files changed, 772 insertions, 1675 deletions
diff --git a/samples/19_lowrez_jam/app/lowrez.rb b/samples/19_lowrez_jam/app/lowrez.rb
new file mode 100644
index 0000000..8b7dd28
--- /dev/null
+++ b/samples/19_lowrez_jam/app/lowrez.rb
@@ -0,0 +1,159 @@
+# Emulation of a 64x64 canvas. Don't change this file unless you know what you're doing :-)
+# Head over to main.rb and study the code there.
+
+LOWREZ_SIZE = 64
+LOWREZ_ZOOM = 10
+LOWREZ_ZOOMED_SIZE = LOWREZ_SIZE * LOWREZ_ZOOM
+LOWREZ_X_OFFSET = (1280 - LOWREZ_ZOOMED_SIZE).half
+LOWREZ_Y_OFFSET = ( 720 - LOWREZ_ZOOMED_SIZE).half
+
+LOWREZ_FONT_XL = -1
+LOWREZ_FONT_XL_HEIGHT = 20
+
+LOWREZ_FONT_LG = -3.5
+LOWREZ_FONT_LG_HEIGHT = 15
+
+LOWREZ_FONT_MD = -6
+LOWREZ_FONT_MD_HEIGHT = 10
+
+LOWREZ_FONT_SM = -8.5
+LOWREZ_FONT_SM_HEIGHT = 5
+
+class LowrezOutputs
+ attr_accessor :width, :height
+
+ def initialize args
+ @args = args
+ @background_color ||= [0, 0, 0]
+ @args.outputs.background_color = @background_color
+ end
+
+ def background_color
+ @background_color ||= [0, 0, 0]
+ end
+
+ def background_color= opts
+ @background_color = opts
+ @args.outputs.background_color = @background_color
+ @args.render_target(:lowrez).solids << [0, 0, LOWREZ_SIZE, LOWREZ_SIZE, @background_color]
+ end
+
+ def solids
+ @args.render_target(:lowrez).solids
+ end
+
+ def borders
+ @args.render_target(:lowrez).borders
+ end
+
+ def sprites
+ @args.render_target(:lowrez).sprites
+ end
+
+ def labels
+ @args.render_target(:lowrez).labels
+ end
+
+ def default_label
+ {
+ x: 0,
+ y: 63,
+ text: "",
+ size_enum: LOWREZ_FONT_SM,
+ alignment_enum: 0,
+ r: 0,
+ g: 0,
+ b: 0,
+ a: 255,
+ font: 'fonts/lowrez.ttf'
+ }
+ end
+
+ def lines
+ @args.render_target(:lowrez).lines
+ end
+
+ def primitives
+ @arsg.render_target(:lowrez).primitives
+ end
+
+ def click
+ return nil unless @args.inputs.mouse.click
+ mouse
+ end
+
+ def mouse_click
+ click
+ end
+
+ def mouse_down
+ @args.inputs.mouse.down
+ end
+
+ def mouse_up
+ @args.inputs.mouse.up
+ end
+
+ def mouse
+ [
+ ((@args.inputs.mouse.x - LOWREZ_X_OFFSET).idiv(LOWREZ_ZOOM)),
+ ((@args.inputs.mouse.y - LOWREZ_Y_OFFSET).idiv(LOWREZ_ZOOM))
+ ]
+ end
+
+ def mouse_position
+ mouse
+ end
+
+ def keyboard
+ @args.inputs.keyboard
+ end
+end
+
+class GTK::Args
+ def init_lowrez
+ return if @lowrez
+ @lowrez = LowrezOutputs.new self
+ end
+
+ def lowrez
+ @lowrez
+ end
+end
+
+module GTK
+ class Runtime
+ alias_method :__original_tick_core__, :tick_core unless Runtime.instance_methods.include?(:__original_tick_core__)
+
+ def tick_core
+ @args.init_lowrez
+ __original_tick_core__
+ @args.render_target(:lowrez)
+ .labels
+ .each do |l|
+ l.text = l.text.downcase
+ l.y += 1
+ end
+
+ @args.render_target(:lowrez)
+ .lines
+ .each do |l|
+ l.y += 1
+ l.y2 += 1
+ l.y2 += 1 if l.y1 != l.y2
+ l.x2 += 1 if l.x1 != l.x2
+ end
+
+ @args.outputs
+ .sprites << { x: 320,
+ y: 40,
+ w: 640,
+ h: 640,
+ source_x: 0,
+ source_y: 0,
+ source_w: 64,
+ source_h: 64,
+ path: :lowrez }
+ end
+ end
+end
diff --git a/samples/19_lowrez_jam/app/main.rb b/samples/19_lowrez_jam/app/main.rb
new file mode 100644
index 0000000..ff7311f
--- /dev/null
+++ b/samples/19_lowrez_jam/app/main.rb
@@ -0,0 +1,613 @@
+require 'app/lowrez.rb'
+
+def tick args
+ # How to set the background color
+ args.lowrez.background_color = [255, 255, 255]
+
+ # ==== HELLO WORLD ======================================================
+ # Steps to get started:
+ # 1. ~def tick args~ is the entry point for your game.
+ # 2. There are quite a few code samples below, remove the "##"
+ # before each line and save the file to see the changes.
+ # 3. 0, 0 is in bottom left and 63, 63 is in top right corner.
+ # 4. Be sure to come to the discord channel if you need
+ # more help: [[http://discord.dragonruby.org]].
+
+ # Commenting and uncommenting code:
+ # - Add a "#" infront of lines to comment out code
+ # - Remove the "#" infront of lines to comment out code
+
+ # Invoke the hello_world subroutine/method
+ hello_world args # <---- add a "#" to the beginning of the line to stop running this subroutine/method.
+ # =======================================================================
+
+
+ # ==== HOW TO RENDER A LABEL ============================================
+ # Uncomment the line below to invoke the how_to_render_a_label subroutine/method.
+ # Note: The method is defined in this file with the signature ~def how_to_render_a_label args~
+ # Scroll down to the method to see the details.
+
+ # Remove the "#" at the beginning of the line below
+ # how_to_render_a_label args # <---- remove the "#" at the begging of this line to run the method
+ # =======================================================================
+
+
+ # ==== HOW TO RENDER A FILLED SQUARE (SOLID) ============================
+ # Remove the "#" at the beginning of the line below
+ # how_to_render_solids args
+ # =======================================================================
+
+
+ # ==== HOW TO RENDER AN UNFILLED SQUARE (BORDER) ========================
+ # Remove the "#" at the beginning of the line below
+ # how_to_render_borders args
+ # =======================================================================
+
+
+ # ==== HOW TO RENDER A LINE =============================================
+ # Remove the "#" at the beginning of the line below
+ # how_to_render_lines args
+ # =======================================================================
+
+
+ # == HOW TO RENDER A SPRITE =============================================
+ # Remove the "#" at the beginning of the line below
+ # how_to_render_sprites args
+ # =======================================================================
+
+
+ # ==== HOW TO MOVE A SPRITE BASED OFF OF USER INPUT =====================
+ # Remove the "#" at the beginning of the line below
+ # how_to_move_a_sprite args
+ # =======================================================================
+
+
+ # ==== HOW TO ANIMATE A SPRITE (SEPERATE PNGS) ==========================
+ # Remove the "#" at the beginning of the line below
+ # how_to_animate_a_sprite args
+ # =======================================================================
+
+
+ # ==== HOW TO ANIMATE A SPRITE (SPRITE SHEET) ===========================
+ # Remove the "#" at the beginning of the line below
+ # how_to_animate_a_sprite_sheet args
+ # =======================================================================
+
+
+ # ==== HOW TO DETERMINE COLLISION =============================================
+ # Remove the "#" at the beginning of the line below
+ # how_to_determine_collision args
+ # =======================================================================
+
+
+ # ==== HOW TO CREATE BUTTONS ==================================================
+ # Remove the "#" at the beginning of the line below
+ # how_to_create_buttons args
+ # =======================================================================
+
+
+ # ==== The line below renders a debug grid, mouse information, and current tick
+ render_debug args
+end
+
+def hello_world args
+ args.lowrez.solids << { x: 0, y: 64, w: 10, h: 10, r: 255 }
+
+ args.lowrez.labels << {
+ x: 32,
+ y: 63,
+ text: "lowrezjam 2020",
+ size_enum: LOWREZ_FONT_SM,
+ alignment_enum: 1,
+ r: 0,
+ g: 0,
+ b: 0,
+ a: 255,
+ font: 'fonts/lowrez.ttf'
+ }
+
+ args.lowrez.sprites << {
+ x: 32 - 10,
+ y: 32 - 10,
+ w: 20,
+ h: 20,
+ path: 'sprites/lowrez-ship-blue.png',
+ a: args.state.tick_count % 255,
+ angle: args.state.tick_count % 360
+ }
+end
+
+
+# =======================================================================
+# ==== HOW TO RENDER A LABEL ============================================
+# =======================================================================
+def how_to_render_a_label args
+ # NOTE: Text is aligned from the TOP LEFT corner
+
+ # Render an EXTRA LARGE/XL label (remove the "#" in front of each line below)
+ args.lowrez.labels << { x: 0, y: 57, text: "hello world",
+ size_enum: LOWREZ_FONT_XL,
+ r: 0, g: 0, b: 0, a: 255,
+ font: 'fonts/lowrez.ttf' }
+
+ # Render a LARGE/LG label (remove the "#" in front of each line below)
+ args.lowrez.labels << { x: 0, y: 36, text: "hello world",
+ size_enum: LOWREZ_FONT_LG,
+ r: 0, g: 0, b: 0, a: 255,
+ font: 'fonts/lowrez.ttf' }
+
+ # Render a MEDIUM/MD label (remove the "#" in front of each line below)
+ args.lowrez.labels << { x: 0, y: 20, text: "hello world",
+ size_enum: LOWREZ_FONT_MD,
+ r: 0, g: 0, b: 0, a: 255,
+ font: 'fonts/lowrez.ttf' }
+
+ # Render a SMALL/SM label (remove the "#" in front of each line below)
+ args.lowrez.labels << { x: 0, y: 9, text: "hello world",
+ size_enum: LOWREZ_FONT_SM,
+ r: 0, g: 0, b: 0, a: 255,
+ font: 'fonts/lowrez.ttf' }
+
+ # You are provided args.lowrez.default_label which returns a Hash that you
+ # can ~merge~ properties with
+ # Example 1
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(text: "default")
+
+ # Example 2
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(x: 31,
+ text: "default",
+ r: 128,
+ g: 128,
+ b: 128)
+end
+
+## # =============================================================================
+## # ==== HOW TO RENDER FILLED SQUARES (SOLIDS) ==================================
+## # =============================================================================
+def how_to_render_solids args
+ # Render a red square at 0, 0 with a width and height of 1
+ args.lowrez.solids << { x: 0, y: 0, w: 1, h: 1, r: 255, g: 0, b: 0, a: 255 }
+
+ # Render a red square at 1, 1 with a width and height of 2
+ args.lowrez.solids << { x: 1, y: 1, w: 2, h: 2, r: 255, g: 0, b: 0, a: 255 }
+
+ # Render a red square at 3, 3 with a width and height of 3
+ args.lowrez.solids << { x: 3, y: 3, w: 3, h: 3, r: 255, g: 0, b: 0 }
+
+ # Render a red square at 6, 6 with a width and height of 4
+ args.lowrez.solids << { x: 7, y: 7, w: 4, h: 4, r: 255, g: 0, b: 0 }
+end
+
+## # =============================================================================
+## # ==== HOW TO RENDER UNFILLED SQUARES (BORDERS) ===============================
+## # =============================================================================
+def how_to_render_borders args
+ # Render a red square at 0, 0 with a width and height of 3
+ args.lowrez.borders << { x: 0, y: 0, w: 3, h: 3, r: 255, g: 0, b: 0, a: 255 }
+
+ # Render a red square at 3, 3 with a width and height of 3
+ args.lowrez.borders << { x: 3, y: 3, w: 4, h: 4, r: 255, g: 0, b: 0, a: 255 }
+
+ # Render a red square at 5, 5 with a width and height of 4
+ args.lowrez.borders << { x: 7, y: 7, w: 5, h: 5, r: 255, g: 0, b: 0, a: 255 }
+end
+
+## # =============================================================================
+## # ==== HOW TO RENDER A LINE ===================================================
+## # =============================================================================
+def how_to_render_lines args
+ # Render a horizontal line at the bottom
+ args.lowrez.lines << { x: 0, y: 0, x2: 63, y2: 0, r: 255 }
+
+ # Render a vertical line at the left
+ args.lowrez.lines << { x: 0, y: 0, x2: 0, y2: 63, r: 255 }
+
+ # Render a diagonal line starting from the bottom left and going to the top right
+ args.lowrez.lines << { x: 0, y: 0, x2: 63, y2: 63, r: 255 }
+end
+
+## # =============================================================================
+## # == HOW TO RENDER A SPRITE ===================================================
+## # =============================================================================
+def how_to_render_sprites args
+ # Loop 10 times and create 10 sprites in 10 positions
+ # Render a sprite at the bottom left with a width and height of 5 and a path of 'sprites/lowrez-ship-blue.png'
+ 10.times do |i|
+ args.lowrez.sprites << {
+ x: i * 5,
+ y: i * 5,
+ w: 5,
+ h: 5,
+ path: 'sprites/lowrez-ship-blue.png'
+ }
+ end
+
+ # Given an array of positions create sprites
+ positions = [
+ { x: 10, y: 42 },
+ { x: 15, y: 45 },
+ { x: 22, y: 33 },
+ ]
+
+ positions.each do |position|
+ # use Ruby's ~Hash#merge~ function to create a sprite
+ args.lowrez.sprites << position.merge(path: 'sprites/lowrez-ship-red.png',
+ w: 5,
+ h: 5)
+ end
+end
+
+## # =============================================================================
+## # ==== HOW TO ANIMATE A SPRITE (SEPERATE PNGS) ==========================
+## # =============================================================================
+def how_to_animate_a_sprite args
+ # STEP 1: Define when you want the animation to start. The animation in this case will start in 3 seconds
+ start_animation_on_tick = 180
+
+ # STEP 2: Get the frame_index given the start tick.
+ sprite_index = start_animation_on_tick.frame_index count: 7, # how many sprites?
+ hold_for: 4, # how long to hold each sprite?
+ repeat: true # should it repeat?
+
+ # STEP 3: frame_index will return nil if the frame hasn't arrived yet
+ if sprite_index
+ # if the sprite_index is populated, use it to determine the sprite path and render it
+ sprite_path = "sprites/explosion-#{sprite_index}.png"
+ args.lowrez.sprites << { x: 0, y: 0, w: 64, h: 64, path: sprite_path }
+ else
+ # if the sprite_index is nil, render a countdown instead
+ countdown_in_seconds = ((start_animation_on_tick - args.state.tick_count) / 60).round(1)
+
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(x: 32,
+ y: 32,
+ text: "count down: #{countdown_in_seconds}",
+ alignment_enum: 1)
+ end
+
+ # render the current tick and the resolved sprite index
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(x: 0,
+ y: 11,
+ text: "tick: #{args.state.tick_count}")
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(x: 0,
+ y: 5,
+ text: "sprite_index: #{sprite_index}")
+end
+
+## # =============================================================================
+## # ==== HOW TO ANIMATE A SPRITE (SPRITE SHEET) =================================
+## # =============================================================================
+def how_to_animate_a_sprite_sheet args
+ # STEP 1: Define when you want the animation to start. The animation in this case will start in 3 seconds
+ start_animation_on_tick = 180
+
+ # STEP 2: Get the frame_index given the start tick.
+ sprite_index = start_animation_on_tick.frame_index count: 7, # how many sprites?
+ hold_for: 4, # how long to hold each sprite?
+ repeat: true # should it repeat?
+
+ # STEP 3: frame_index will return nil if the frame hasn't arrived yet
+ if sprite_index
+ # if the sprite_index is populated, use it to determine the source rectangle and render it
+ args.lowrez.sprites << {
+ x: 0,
+ y: 0,
+ w: 64,
+ h: 64,
+ path: "sprites/explosion-sheet.png",
+ source_x: 32 * sprite_index,
+ source_y: 0,
+ source_w: 32,
+ source_h: 32
+ }
+ else
+ # if the sprite_index is nil, render a countdown instead
+ countdown_in_seconds = ((start_animation_on_tick - args.state.tick_count) / 60).round(1)
+
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(x: 32,
+ y: 32,
+ text: "count down: #{countdown_in_seconds}",
+ alignment_enum: 1)
+ end
+
+ # render the current tick and the resolved sprite index
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(x: 0,
+ y: 11,
+ text: "tick: #{args.state.tick_count}")
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(x: 0,
+ y: 5,
+ text: "sprite_index: #{sprite_index}")
+end
+
+## # =============================================================================
+## # ==== HOW TO STORE STATE, ACCEPT INPUT, AND RENDER SPRITE BASED OFF OF STATE =
+## # =============================================================================
+def how_to_move_a_sprite args
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(x: 32,
+ y: 62, text: "use arrow keys",
+ alignment_enum: 1)
+
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(x: 32,
+ y: 56, text: "use wasd",
+ alignment_enum: 1)
+
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(x: 32,
+ y: 50, text: "or click",
+ alignment_enum: 1)
+
+ # set the initial values for x and y using ||= ("or equal operator")
+ args.state.ship.x ||= 0
+ args.state.ship.y ||= 0
+
+ # if a mouse click occurs, update the ship's x and y to be the location of the click
+ if args.lowrez.mouse_click
+ args.state.ship.x = args.lowrez.mouse_click.x
+ args.state.ship.y = args.lowrez.mouse_click.y
+ end
+
+ # if a or left arrow is pressed/held, decrement the ships x position
+ if args.lowrez.keyboard.left
+ args.state.ship.x -= 1
+ end
+
+ # if d or right arrow is pressed/held, increment the ships x position
+ if args.lowrez.keyboard.right
+ args.state.ship.x += 1
+ end
+
+ # if s or down arrow is pressed/held, decrement the ships y position
+ if args.lowrez.keyboard.down
+ args.state.ship.y -= 1
+ end
+
+ # if w or up arrow is pressed/held, increment the ships y position
+ if args.lowrez.keyboard.up
+ args.state.ship.y += 1
+ end
+
+ # render the sprite to the screen using the position stored in args.state.ship
+ args.lowrez.sprites << {
+ x: args.state.ship.x,
+ y: args.state.ship.y,
+ w: 5,
+ h: 5,
+ path: 'sprites/lowrez-ship-blue.png',
+ # parameters beyond this point are optional
+ angle: 0, # Note: rotation angle is denoted in degrees NOT radians
+ r: 255,
+ g: 255,
+ b: 255,
+ a: 255
+ }
+end
+
+# =======================================================================
+# ==== HOW TO DETERMINE COLLISION =======================================
+# =======================================================================
+def how_to_determine_collision args
+ # Render the instructions
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(x: 32,
+ y: 62, text: "click anywhere",
+ alignment_enum: 1)
+
+ # if a mouse click occurs:
+ # - set ship_one if it isn't set
+ # - set ship_two if it isn't set
+ # - otherwise reset ship one and ship two
+ if args.lowrez.mouse_click
+ # is ship_one set?
+ if !args.state.ship_one
+ args.state.ship_one = { x: args.lowrez.mouse_click.x - 10,
+ y: args.lowrez.mouse_click.y - 10,
+ w: 20,
+ h: 20 }
+ # is ship_one set?
+ elsif !args.state.ship_two
+ args.state.ship_two = { x: args.lowrez.mouse_click.x - 10,
+ y: args.lowrez.mouse_click.y - 10,
+ w: 20,
+ h: 20 }
+ # should we reset?
+ else
+ args.state.ship_one = nil
+ args.state.ship_two = nil
+ end
+ end
+
+ # render ship one if it's set
+ if args.state.ship_one
+ # use Ruby's .merge method which is available on ~Hash~ to set the sprite and alpha
+ # render ship one
+ args.lowrez.sprites << args.state.ship_one.merge(path: 'sprites/lowrez-ship-blue.png', a: 100)
+ end
+
+ if args.state.ship_two
+ # use Ruby's .merge method which is available on ~Hash~ to set the sprite and alpha
+ # render ship two
+ args.lowrez.sprites << args.state.ship_two.merge(path: 'sprites/lowrez-ship-red.png', a: 100)
+ end
+
+ # if both ship one and ship two are set, then determine collision
+ if args.state.ship_one && args.state.ship_two
+ # collision is determined using the intersect_rect? method
+ if args.state.ship_one.intersect_rect? args.state.ship_two
+ # if collision occurred, render the words collision!
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(x: 31,
+ y: 5,
+ text: "collision!",
+ alignment_enum: 1)
+ else
+ # if collision occurred, render the words no collision.
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(x: 31,
+ y: 5,
+ text: "no collision.",
+ alignment_enum: 1)
+ end
+ else
+ # if both ship one and ship two aren't set, then render --
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(x: 31,
+ y: 6,
+ text: "--",
+ alignment_enum: 1)
+ end
+end
+
+## # =============================================================================
+## # ==== HOW TO CREATE BUTTONS ==================================================
+## # =============================================================================
+def how_to_create_buttons args
+ # Define a button style
+ args.state.button_style = { w: 62, h: 10, r: 80, g: 80, b: 80 }
+ args.state.label_style = { r: 80, g: 80, b: 80 }
+
+ # Render instructions
+ args.state.button_message ||= "press a button!"
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(args.state.label_style)
+ .merge(x: 32,
+ y: 62,
+ text: args.state.button_message,
+ alignment_enum: 1)
+
+
+ # Creates button one using a border and a label
+ args.state.button_one_border = args.state.button_style.merge( x: 1, y: 32)
+ args.lowrez.borders << args.state.button_one_border
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(args.state.label_style)
+ .merge(x: args.state.button_one_border.x + 2,
+ y: args.state.button_one_border.y + LOWREZ_FONT_SM_HEIGHT + 2,
+ text: "button one")
+
+ # Creates button two using a border and a label
+ args.state.button_two_border = args.state.button_style.merge( x: 1, y: 20)
+
+ args.lowrez.borders << args.state.button_two_border
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(args.state.label_style)
+ .merge(x: args.state.button_two_border.x + 2,
+ y: args.state.button_two_border.y + LOWREZ_FONT_SM_HEIGHT + 2,
+ text: "button two")
+
+ # Initialize the state variable that tracks which button was clicked to "" (empty stringI
+ args.state.last_button_clicked ||= "--"
+
+ # If a click occurs, check to see if either button one, or button two was clicked
+ # using the inside_rect? method of the mouse
+ # set args.state.last_button_clicked accordingly
+ if args.lowrez.mouse_click
+ if args.lowrez.mouse_click.inside_rect? args.state.button_one_border
+ args.state.last_button_clicked = "one clicked!"
+ elsif args.lowrez.mouse_click.inside_rect? args.state.button_two_border
+ args.state.last_button_clicked = "two clicked!"
+ else
+ args.state.last_button_clicked = "--"
+ end
+ end
+
+ # Render the current value of args.state.last_button_clicked
+ args.lowrez.labels << args.lowrez
+ .default_label
+ .merge(args.state.label_style)
+ .merge(x: 32,
+ y: 5,
+ text: args.state.last_button_clicked,
+ alignment_enum: 1)
+end
+
+
+def render_debug args
+ if !args.state.grid_rendered
+ 65.map_with_index do |i|
+ args.outputs.static_debug << {
+ x: LOWREZ_X_OFFSET,
+ y: LOWREZ_Y_OFFSET + (i * 10),
+ x2: LOWREZ_X_OFFSET + LOWREZ_ZOOMED_SIZE,
+ y2: LOWREZ_Y_OFFSET + (i * 10),
+ r: 128,
+ g: 128,
+ b: 128,
+ a: 80
+ }.line
+
+ args.outputs.static_debug << {
+ x: LOWREZ_X_OFFSET + (i * 10),
+ y: LOWREZ_Y_OFFSET,
+ x2: LOWREZ_X_OFFSET + (i * 10),
+ y2: LOWREZ_Y_OFFSET + LOWREZ_ZOOMED_SIZE,
+ r: 128,
+ g: 128,
+ b: 128,
+ a: 80
+ }.line
+ end
+ end
+
+ args.state.grid_rendered = true
+
+ args.state.last_click ||= 0
+ args.state.last_up ||= 0
+ args.state.last_click = args.state.tick_count if args.lowrez.mouse_down # you can also use args.lowrez.click
+ args.state.last_up = args.state.tick_count if args.lowrez.mouse_up
+ args.state.label_style = { size_enum: -1.5 }
+
+ args.state.watch_list = [
+ "args.state.tick_count is: #{args.state.tick_count}",
+ "args.lowrez.mouse_position is: #{args.lowrez.mouse_position.x}, #{args.lowrez.mouse_position.y}",
+ "args.lowrez.mouse_down tick: #{args.state.last_click || "never"}",
+ "args.lowrez.mouse_up tick: #{args.state.last_up || "false"}",
+ ]
+
+ args.outputs.debug << args.state
+ .watch_list
+ .map_with_index do |text, i|
+ {
+ x: 5,
+ y: 720 - (i * 20),
+ text: text,
+ size_enum: -1.5
+ }.label
+ end
+
+ args.outputs.debug << {
+ x: 640,
+ y: 25,
+ text: "INFO: dev mode is currently enabled. Comment out the invocation of ~render_debug~ within the ~tick~ method to hide the debug layer.",
+ size_enum: -0.5,
+ alignment_enum: 1
+ }.label
+end
+
+$gtk.reset
diff --git a/samples/19_lowrez_jam/fonts/lowrez.ttf b/samples/19_lowrez_jam/fonts/lowrez.ttf
new file mode 100644
index 0000000..7085f45
--- /dev/null
+++ b/samples/19_lowrez_jam/fonts/lowrez.ttf
Binary files differ
diff --git a/samples/19_lowrez_jam_01_hello_world/sprites/explosion_0.png b/samples/19_lowrez_jam/sprites/explosion-0.png
index f48636f..f48636f 100644
--- a/samples/19_lowrez_jam_01_hello_world/sprites/explosion_0.png
+++ b/samples/19_lowrez_jam/sprites/explosion-0.png
Binary files differ
diff --git a/samples/19_lowrez_jam_01_hello_world/sprites/explosion_1.png b/samples/19_lowrez_jam/sprites/explosion-1.png
index b4018d9..b4018d9 100644
--- a/samples/19_lowrez_jam_01_hello_world/sprites/explosion_1.png
+++ b/samples/19_lowrez_jam/sprites/explosion-1.png
Binary files differ
diff --git a/samples/19_lowrez_jam_01_hello_world/sprites/explosion_2.png b/samples/19_lowrez_jam/sprites/explosion-2.png
index 3abaedd..3abaedd 100644
--- a/samples/19_lowrez_jam_01_hello_world/sprites/explosion_2.png
+++ b/samples/19_lowrez_jam/sprites/explosion-2.png
Binary files differ
diff --git a/samples/19_lowrez_jam_01_hello_world/sprites/explosion_3.png b/samples/19_lowrez_jam/sprites/explosion-3.png
index fe94a5a..fe94a5a 100644
--- a/samples/19_lowrez_jam_01_hello_world/sprites/explosion_3.png
+++ b/samples/19_lowrez_jam/sprites/explosion-3.png
Binary files differ
diff --git a/samples/19_lowrez_jam_01_hello_world/sprites/explosion_4.png b/samples/19_lowrez_jam/sprites/explosion-4.png
index ed04237..ed04237 100644
--- a/samples/19_lowrez_jam_01_hello_world/sprites/explosion_4.png
+++ b/samples/19_lowrez_jam/sprites/explosion-4.png
Binary files differ
diff --git a/samples/19_lowrez_jam_01_hello_world/sprites/explosion_5.png b/samples/19_lowrez_jam/sprites/explosion-5.png
index 2cd8f06..2cd8f06 100644
--- a/samples/19_lowrez_jam_01_hello_world/sprites/explosion_5.png
+++ b/samples/19_lowrez_jam/sprites/explosion-5.png
Binary files differ
diff --git a/samples/19_lowrez_jam_01_hello_world/sprites/explosion_6.png b/samples/19_lowrez_jam/sprites/explosion-6.png
index e55909c..e55909c 100644
--- a/samples/19_lowrez_jam_01_hello_world/sprites/explosion_6.png
+++ b/samples/19_lowrez_jam/sprites/explosion-6.png
Binary files differ
diff --git a/samples/19_lowrez_jam/sprites/explosion-sheet.png b/samples/19_lowrez_jam/sprites/explosion-sheet.png
new file mode 100644
index 0000000..8559a5c
--- /dev/null
+++ b/samples/19_lowrez_jam/sprites/explosion-sheet.png
Binary files differ
diff --git a/samples/19_lowrez_jam_03_space_shooter/sprites/ship_blue.png b/samples/19_lowrez_jam/sprites/lowrez-ship-blue.png
index 7a3d3aa..7a3d3aa 100644
--- a/samples/19_lowrez_jam_03_space_shooter/sprites/ship_blue.png
+++ b/samples/19_lowrez_jam/sprites/lowrez-ship-blue.png
Binary files differ
diff --git a/samples/19_lowrez_jam_03_space_shooter/sprites/ship_red.png b/samples/19_lowrez_jam/sprites/lowrez-ship-red.png
index dd1a1d4..dd1a1d4 100644
--- a/samples/19_lowrez_jam_03_space_shooter/sprites/ship_red.png
+++ b/samples/19_lowrez_jam/sprites/lowrez-ship-red.png
Binary files differ
diff --git a/samples/19_lowrez_jam_01_hello_world/app/main.rb b/samples/19_lowrez_jam_01_hello_world/app/main.rb
deleted file mode 100644
index 1181785..0000000
--- a/samples/19_lowrez_jam_01_hello_world/app/main.rb
+++ /dev/null
@@ -1,192 +0,0 @@
-=begin
-
- Reminders:
-
- - args.outputs.lines: An array. The values generate a line.
- The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE, ALPHA]
- For more information about lines, go to mygame/documentation/04-lines.md.
-
- In this sample app, we're using lines to create the grid lines that make
- a 64x64 grid.
-
- - args.outputs.labels: An array. The values generate a label.
- The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]
- For more information about labels, go to mygame/documentation/02-labels.md.
-
- - args.outputs.sprites: An array. The values generate a sprite.
- The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH]
- For more information about sprites, go to mygame/documentation/05-sprites.md.
-
- - args.outputs.solids: An array. The values generate a solid.
- The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]
- For more information about solids, go to mygame/documentation/03-solids-and-borders.md.
-
- - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated
- as Ruby code, and the placeholder is replaced with its corresponding value or result.
-
- - args.state.new_entity: Used when we want to create a new object, like a sprite or button.
- For example, if we want to create a new button, we would declare it as a new entity and
- then define its properties. (Remember, you can use state to define ANY property and it will
- be retained across frames.)
-
- - num1.idiv(num2): Divides two numbers and returns an integer.
-
- - num1.fdiv(num2): Divides two numbers and returns a float (has a decimal).
-
- - args.click.point.(x|y): The x and y location of the mouse.
- For more information about the mouse, go to mygame/documentation/07-mouse.md.
-
- - Symbol (:): Ruby object with a name and an internal ID. Symbols are useful
- because with a given symbol name, you can refer to the same object throughout
- a Ruby program.
-
-=end
-
-# https://twitter.com/hashtag/LOWREZJAM
-
-# Sets sprite, label, and solid definitions and adds them to appropriate collections
-def lowrez_tick args, lowrez_sprites, lowrez_labels, lowrez_borders, lowrez_solids, lowrez_mouse
- args.state.show_gridlines = true # shows gridlines; change to false and they won't be visible
-
- # Iterates through the images in the sprites folder using string interpolation
- # There are 6 pngs that represent the full animation
- # Each png is shown for 4 frames
- # The animation should loop forever (true)
- lowrez_sprites << [0, 0, 64, 64, "sprites/explosion_#{0.frame_index 6, 4, true}.png"]
-
- # Creates labels of alphabet in different positions and colors
- lowrez_labels << [0, 0, "ABCDEFGHIJKLM", 255, 0, 0] # red label
- lowrez_labels << [0, 29, "ABCDEFGHIJKLM", 0, 255, 0] # green label
- lowrez_labels << [0, 60, "ABCDEFGHIJKLM", 0, 0, 255, 255] # blue label
-
- #Creates a solid black background for the 64x64 canvas
- args.render_target(:lowrez).solids << [0, 0, 64, 64, 255, 255, 255]
-end
-
-###################################################################################
-# YOU CAN PLAY AROUND WITH THE CODE BELOW, BUT USE CAUTION AS THIS IS WHAT EMULATES
-# THE 64x64 CANVAS.
-###################################################################################
-
-# Sets values to produce 64x64 canvas.
-# These values are not changed, which is why ||= is not used.
-TINY_RESOLUTION = 64
-TINY_SCALE = 720.fdiv(TINY_RESOLUTION) # original dimension of 720 is scaled down by 64
-CENTER_OFFSET = (1280 - 720).fdiv(2) # sets center
-EMULATED_FONT_SIZE = 20
-EMULATED_FONT_X_ZERO = 0 # increasing this value would shift labels to the right
-EMULATED_FONT_Y_ZERO = 46 # increasing shifts labels up, decreasing shifts labels down
-
-# Creates empty collections, and calls methods needed for the game to run properly.
-def tick args
- sprites = []
- labels = []
- borders = []
- solids = []
- mouse = emulate_lowrez_mouse args # calls method to set mouse to mouse's position
- args.state.show_gridlines = false # grid lines are not shown
- lowrez_tick args, sprites, labels, borders, solids, mouse # contains definitions
- render_gridlines_if_needed args # outputs grid lines if show_gridlines is true
- render_mouse_crosshairs args, mouse # outputs position of mouse using label
- emulate_lowrez_scene args, sprites, labels, borders, solids, mouse # emulates scene on screen
-end
-
-# Sets values based on the position of the mouse on the screen.
-def emulate_lowrez_mouse args
- # declares mouse as a new entity and sets values for x and y variables
- args.state.new_entity_strict(:lowrez_mouse) do |m|
- # mouse's original coordinates are scaled down to match canvas
- # original coordinates are within 1280x720 dimensions
- m.x = args.mouse.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1
- m.y = args.mouse.y.idiv(TINY_SCALE)
-
- if args.mouse.click # if mouse is clicked
- m.click = [ # sets definition and stores mouse click's position
- args.mouse.click.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1,
- args.mouse.click.point.y.idiv(TINY_SCALE)
- ]
- m.down = m.click # down stores click's value, which is mouse click's position
- else
- m.click = nil # if no click occurred, both click and down are empty (do not store any position)
- m.down = nil
- end
-
- if args.mouse.up # if mouse is up (not being pressed or held down)
- m.up = [ # sets definition, stores mouse's position
- args.mouse.up.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1,
- args.mouse.up.point.y.idiv(TINY_SCALE)
- ]
- else
- m.up = nil # if mouse is not in "up" state, up is empty (has no value)
- end
- end
-end
-
-# Outputs position of mouse on screen using white label
-def render_mouse_crosshairs args, mouse
- return unless args.state.show_gridlines # return unless true (grid lines are showing)
- args.labels << [10, 25, "mouse: #{mouse.x} #{mouse.y}", 255, 255, 255] # string interpolation
-end
-
-# Emulates the low rez scene by adding solids, sprites, etc. to appropriate collections
-# and creating labels for the characters of alphabet
-def emulate_lowrez_scene args, sprites, labels, borders, solids, mouse
- args.render_target(:lowrez).solids << [0, 0, 1280, 720] # sets black background in grid
- args.render_target(:lowrez).sprites << sprites # outputs sprites
- args.render_target(:lowrez).borders << borders # outputs borders
- args.render_target(:lowrez).solids << solids # outputs solids
-
- # The font that is used is saved in the game's folder.
- # Without the .ttf file, the label would not be created correctly.
- args.outputs.primitives << labels.map do |l| # outputs all elements of labels collection as primitive
- as_label = l.label
- l.text.each_char.each_with_index.map do |char, i| # perform action on each character in labels collection
- # label definition
- # each label starts on left side of grid and places space between alphabet characters
- # centered to fit within grid dimensions
- [CENTER_OFFSET + EMULATED_FONT_X_ZERO + (as_label.x * TINY_SCALE) + i * 5 * TINY_SCALE,
- EMULATED_FONT_Y_ZERO + (as_label.y * TINY_SCALE), char,
- EMULATED_FONT_SIZE, 0, as_label.r, as_label.g, as_label.b, as_label.a, 'dragonruby-gtk-4x4.ttf'].label
- end
- end
-
- # placed in center; width and height are scaled down to fit canvas
- # comment this line out and the sprites do not appear, and neither does the black canvas background
- args.sprites << [CENTER_OFFSET, 0, 1280 * TINY_SCALE, 720 * TINY_SCALE, :lowrez]
-
- args.primitives << [0, 0, CENTER_OFFSET, 720].solid # black background on left side of grid
- args.primitives << [1280 - CENTER_OFFSET, 0, CENTER_OFFSET, 720].solid # black on right side of grid
- args.primitives << [0, 0, 1280, 2].solid # black on bottom; change 2 to 200 and see what happens
-end
-
-def render_gridlines_if_needed args
- # if grid lines are showing and static_lines collection (which contains grid lines) is empty
- if args.state.show_gridlines && args.static_lines.length == 0
- # add to the collection by adding line definitions 65 times (because of 64x64 canvas)
- # placed at equal distance apart within grid dimensions
- args.static_lines << 65.times.map do |i|
- [
- # [starting x, starting y, ending x, ending y, red, green, blue]
- # Vertical lines have the same starting and ending x value.
- # To make the vertical grid lines look thicker and more prominent, two separators are
- # placed together one pixel apart (explains "+1" in x parameter) as one vertical grid line.
- [CENTER_OFFSET + i * TINY_SCALE + 1, 0,
- CENTER_OFFSET + i * TINY_SCALE + 1, 720, 128, 128, 128], # vertical line 1
- [CENTER_OFFSET + i * TINY_SCALE, 0,
- CENTER_OFFSET + i * TINY_SCALE, 720, 128, 128, 128], # vertical line 2
- # Horizontal lines have the same starting and ending y value.
- # The two horizontal separators that are considered one grid line are placed
- # one pixel apart (explains the "1 +" in the y parameter).
- # That is why there are four line definitions (distinguished by []) being added to static_lines.
- # Two vertical and two horizontal separators are added to create one vertical
- # and one horizontal grid line.
- [CENTER_OFFSET, 0 + i * TINY_SCALE,
- CENTER_OFFSET + 720, 0 + i * TINY_SCALE, 128, 128, 128], # horizontal line 1
- [CENTER_OFFSET, 1 + i * TINY_SCALE,
- CENTER_OFFSET + 720, 1 + i * TINY_SCALE, 128, 128, 128] # horizontal line 2
- ]
- end
- elsif !args.state.show_gridlines # if show_gridlines is false (grid lines are not showing)
- args.static_lines.clear # clear the collection so no grid lines are in it
- end
-end
diff --git a/samples/19_lowrez_jam_01_hello_world/dragonruby-gtk-4x4.ttf b/samples/19_lowrez_jam_01_hello_world/dragonruby-gtk-4x4.ttf
deleted file mode 100644
index 24cc711..0000000
--- a/samples/19_lowrez_jam_01_hello_world/dragonruby-gtk-4x4.ttf
+++ /dev/null
Binary files differ
diff --git a/samples/19_lowrez_jam_01_hello_world/license-for-sample.txt b/samples/19_lowrez_jam_01_hello_world/license-for-sample.txt
deleted file mode 100644
index 100dcec..0000000
--- a/samples/19_lowrez_jam_01_hello_world/license-for-sample.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-Copyright 2019 DragonRuby LLC
-
-MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/samples/19_lowrez_jam_01_hello_world/replay.txt b/samples/19_lowrez_jam_01_hello_world/replay.txt
deleted file mode 100644
index d421cd2..0000000
--- a/samples/19_lowrez_jam_01_hello_world/replay.txt
+++ /dev/null
@@ -1,339 +0,0 @@
-replay_version 2.0
-stopped_at 987
-seed 100
-recorded_at Sun Sep 29 22:36:39 2019
-[:mouse_move, 793, 490, 2, 1, 58]
-[:mouse_move, 782, 488, 2, 2, 59]
-[:mouse_move, 777, 488, 2, 3, 60]
-[:mouse_move, 769, 487, 2, 4, 61]
-[:mouse_move, 703, 487, 2, 5, 62]
-[:mouse_move, 658, 487, 2, 6, 62]
-[:mouse_move, 547, 495, 2, 7, 64]
-[:mouse_move, 482, 507, 2, 8, 65]
-[:mouse_move, 435, 519, 2, 9, 66]
-[:mouse_move, 420, 523, 2, 10, 67]
-[:mouse_move, 393, 531, 2, 11, 68]
-[:mouse_move, 373, 537, 2, 12, 69]
-[:mouse_move, 369, 538, 2, 13, 70]
-[:mouse_move, 366, 538, 2, 14, 71]
-[:mouse_move, 365, 539, 2, 15, 72]
-[:mouse_move, 364, 539, 2, 16, 73]
-[:mouse_move, 364, 538, 2, 17, 76]
-[:mouse_move, 363, 540, 2, 18, 78]
-[:mouse_move, 361, 545, 2, 19, 79]
-[:mouse_move, 353, 558, 2, 20, 80]
-[:mouse_move, 329, 593, 2, 21, 81]
-[:mouse_move, 322, 603, 2, 22, 82]
-[:mouse_move, 289, 646, 2, 23, 83]
-[:mouse_move, 274, 662, 2, 24, 84]
-[:mouse_move, 248, 685, 2, 25, 85]
-[:mouse_move, 237, 690, 2, 26, 87]
-[:mouse_move, 232, 692, 2, 27, 88]
-[:mouse_move, 223, 693, 2, 28, 89]
-[:mouse_move, 221, 693, 2, 29, 100]
-[:mouse_move, 202, 693, 2, 30, 101]
-[:mouse_move, 191, 693, 2, 31, 102]
-[:mouse_move, 176, 693, 2, 32, 103]
-[:mouse_move, 170, 693, 2, 33, 104]
-[:mouse_move, 151, 693, 2, 34, 105]
-[:mouse_move, 142, 693, 2, 35, 106]
-[:mouse_move, 129, 695, 2, 36, 107]
-[:mouse_move, 113, 699, 2, 37, 108]
-[:mouse_move, 109, 700, 2, 38, 109]
-[:mouse_move, 96, 705, 2, 39, 110]
-[:mouse_move, 94, 705, 2, 40, 111]
-[:mouse_move, 81, 709, 2, 41, 112]
-[:mouse_move, 78, 709, 2, 42, 113]
-[:mouse_move, 69, 711, 2, 43, 114]
-[:mouse_move, 68, 711, 2, 44, 115]
-[:mouse_move, 62, 711, 2, 45, 116]
-[:mouse_move, 59, 711, 2, 46, 117]
-[:mouse_move, 56, 711, 2, 47, 118]
-[:mouse_move, 54, 711, 2, 48, 119]
-[:mouse_move, 48, 711, 2, 49, 120]
-[:mouse_move, 46, 711, 2, 50, 121]
-[:mouse_move, 39, 711, 2, 51, 122]
-[:mouse_move, 35, 711, 2, 52, 123]
-[:mouse_move, 31, 711, 2, 53, 124]
-[:mouse_move, 28, 711, 2, 54, 125]
-[:mouse_move, 26, 711, 2, 55, 126]
-[:mouse_move, 24, 711, 2, 56, 127]
-[:mouse_move, 23, 710, 2, 57, 128]
-[:mouse_move, 22, 710, 2, 58, 130]
-[:mouse_move, 23, 710, 2, 59, 134]
-[:mouse_move, 25, 710, 2, 60, 136]
-[:mouse_move, 26, 710, 2, 61, 137]
-[:mouse_move, 28, 710, 2, 62, 138]
-[:mouse_move, 33, 710, 2, 63, 139]
-[:mouse_move, 37, 709, 2, 64, 140]
-[:mouse_move, 47, 707, 2, 65, 141]
-[:mouse_move, 53, 705, 2, 66, 142]
-[:mouse_move, 63, 704, 2, 67, 143]
-[:mouse_move, 67, 703, 2, 68, 144]
-[:mouse_move, 73, 703, 2, 69, 145]
-[:mouse_move, 76, 703, 2, 70, 146]
-[:mouse_move, 81, 703, 2, 71, 147]
-[:mouse_move, 84, 703, 2, 72, 148]
-[:mouse_move, 87, 703, 2, 73, 149]
-[:mouse_move, 88, 703, 2, 74, 150]
-[:mouse_move, 91, 703, 2, 75, 151]
-[:mouse_move, 93, 703, 2, 76, 152]
-[:mouse_move, 95, 704, 2, 77, 153]
-[:mouse_move, 97, 704, 2, 78, 154]
-[:mouse_move, 100, 704, 2, 79, 155]
-[:mouse_move, 101, 705, 2, 80, 156]
-[:mouse_move, 103, 705, 2, 81, 157]
-[:mouse_move, 104, 705, 2, 82, 159]
-[:mouse_move, 104, 706, 2, 83, 160]
-[:mouse_move, 105, 706, 2, 84, 161]
-[:mouse_move, 106, 707, 2, 85, 163]
-[:mouse_move, 107, 708, 2, 86, 165]
-[:mouse_move, 108, 708, 2, 87, 166]
-[:mouse_move, 109, 708, 2, 88, 167]
-[:mouse_move, 111, 709, 2, 89, 168]
-[:mouse_move, 113, 709, 2, 90, 169]
-[:mouse_move, 115, 709, 2, 91, 170]
-[:mouse_move, 117, 709, 2, 92, 172]
-[:mouse_move, 118, 709, 2, 93, 179]
-[:mouse_move, 121, 708, 2, 94, 190]
-[:mouse_move, 126, 706, 2, 95, 191]
-[:mouse_move, 131, 704, 2, 96, 192]
-[:mouse_move, 145, 697, 2, 97, 193]
-[:mouse_move, 159, 689, 2, 98, 194]
-[:mouse_move, 181, 678, 2, 99, 195]
-[:mouse_move, 187, 675, 2, 100, 196]
-[:mouse_move, 201, 669, 2, 101, 197]
-[:mouse_move, 217, 662, 2, 102, 198]
-[:mouse_move, 222, 661, 2, 103, 199]
-[:mouse_move, 226, 660, 2, 104, 200]
-[:mouse_move, 231, 660, 2, 105, 201]
-[:mouse_move, 233, 660, 2, 106, 202]
-[:mouse_move, 235, 660, 2, 107, 203]
-[:mouse_move, 236, 660, 2, 108, 204]
-[:mouse_move, 238, 660, 2, 109, 205]
-[:mouse_move, 239, 660, 2, 110, 206]
-[:mouse_move, 243, 661, 2, 111, 207]
-[:mouse_move, 245, 661, 2, 112, 208]
-[:mouse_move, 249, 662, 2, 113, 209]
-[:mouse_move, 252, 662, 2, 114, 210]
-[:mouse_move, 257, 662, 2, 115, 211]
-[:mouse_move, 258, 663, 2, 116, 212]
-[:mouse_move, 263, 663, 2, 117, 213]
-[:mouse_move, 265, 663, 2, 118, 214]
-[:mouse_move, 267, 663, 2, 119, 215]
-[:mouse_move, 268, 663, 2, 120, 217]
-[:mouse_move, 269, 663, 2, 121, 218]
-[:mouse_move, 270, 663, 2, 122, 224]
-[:mouse_move, 271, 663, 2, 123, 225]
-[:mouse_move, 274, 663, 2, 124, 226]
-[:mouse_move, 275, 663, 2, 125, 227]
-[:mouse_move, 278, 663, 2, 126, 228]
-[:mouse_move, 279, 663, 2, 127, 229]
-[:mouse_move, 280, 664, 2, 128, 232]
-[:mouse_move, 281, 664, 2, 129, 241]
-[:mouse_move, 281, 665, 2, 130, 242]
-[:mouse_move, 282, 665, 2, 131, 244]
-[:mouse_move, 283, 665, 2, 132, 246]
-[:mouse_move, 283, 666, 2, 133, 247]
-[:mouse_move, 283, 667, 2, 134, 292]
-[:mouse_move, 283, 668, 2, 135, 295]
-[:mouse_move, 283, 670, 2, 136, 296]
-[:mouse_move, 283, 671, 2, 137, 297]
-[:mouse_move, 283, 674, 2, 138, 298]
-[:mouse_move, 283, 676, 2, 139, 299]
-[:mouse_move, 283, 680, 2, 140, 300]
-[:mouse_move, 283, 682, 2, 141, 301]
-[:mouse_move, 283, 684, 2, 142, 303]
-[:mouse_move, 283, 686, 2, 143, 304]
-[:mouse_move, 283, 687, 2, 144, 306]
-[:mouse_move, 283, 688, 2, 145, 307]
-[:mouse_move, 283, 689, 2, 146, 308]
-[:mouse_move, 283, 690, 2, 147, 309]
-[:mouse_move, 283, 691, 2, 148, 310]
-[:mouse_move, 283, 692, 2, 149, 311]
-[:mouse_move, 283, 694, 2, 150, 313]
-[:mouse_move, 283, 695, 2, 151, 314]
-[:mouse_move, 283, 696, 2, 152, 315]
-[:mouse_move, 283, 698, 2, 153, 316]
-[:mouse_move, 283, 700, 2, 154, 317]
-[:mouse_move, 283, 701, 2, 155, 318]
-[:mouse_move, 282, 702, 2, 156, 319]
-[:mouse_move, 282, 703, 2, 157, 320]
-[:mouse_move, 282, 704, 2, 158, 321]
-[:mouse_move, 281, 705, 2, 159, 322]
-[:mouse_move, 281, 706, 2, 160, 323]
-[:mouse_move, 281, 707, 2, 161, 325]
-[:mouse_move, 281, 708, 2, 162, 326]
-[:mouse_move, 281, 709, 2, 163, 327]
-[:mouse_move, 281, 710, 2, 164, 329]
-[:mouse_move, 281, 711, 2, 165, 330]
-[:mouse_move, 281, 712, 2, 166, 333]
-[:mouse_move, 282, 712, 2, 167, 338]
-[:mouse_move, 283, 712, 2, 168, 348]
-[:mouse_move, 283, 713, 2, 169, 357]
-[:mouse_move, 284, 713, 2, 170, 358]
-[:mouse_move, 285, 713, 2, 171, 367]
-[:mouse_move, 285, 712, 2, 172, 471]
-[:mouse_move, 284, 712, 2, 173, 472]
-[:mouse_move, 283, 712, 2, 174, 475]
-[:mouse_move, 280, 710, 2, 175, 487]
-[:mouse_move, 274, 709, 2, 176, 488]
-[:mouse_move, 255, 707, 2, 177, 489]
-[:mouse_move, 242, 706, 2, 178, 490]
-[:mouse_move, 228, 705, 2, 179, 491]
-[:mouse_move, 195, 705, 2, 180, 492]
-[:mouse_move, 179, 705, 2, 181, 493]
-[:mouse_move, 160, 705, 2, 182, 494]
-[:mouse_move, 156, 705, 2, 183, 495]
-[:mouse_move, 142, 706, 2, 184, 496]
-[:mouse_move, 139, 706, 2, 185, 497]
-[:mouse_move, 133, 706, 2, 186, 498]
-[:mouse_move, 131, 706, 2, 187, 499]
-[:mouse_move, 130, 706, 2, 188, 500]
-[:mouse_move, 129, 706, 2, 189, 501]
-[:mouse_move, 128, 706, 2, 190, 502]
-[:mouse_move, 127, 706, 2, 191, 503]
-[:mouse_move, 126, 705, 2, 192, 504]
-[:mouse_move, 125, 705, 2, 193, 505]
-[:mouse_move, 123, 705, 2, 194, 506]
-[:mouse_move, 121, 705, 2, 195, 507]
-[:mouse_move, 118, 705, 2, 196, 508]
-[:mouse_move, 116, 705, 2, 197, 509]
-[:mouse_move, 112, 705, 2, 198, 510]
-[:mouse_move, 111, 705, 2, 199, 511]
-[:mouse_move, 107, 706, 2, 200, 512]
-[:mouse_move, 106, 706, 2, 201, 513]
-[:mouse_move, 103, 706, 2, 202, 514]
-[:mouse_move, 102, 706, 2, 203, 515]
-[:mouse_move, 98, 706, 2, 204, 516]
-[:mouse_move, 96, 706, 2, 205, 517]
-[:mouse_move, 95, 706, 2, 206, 518]
-[:mouse_move, 92, 706, 2, 207, 519]
-[:mouse_move, 91, 706, 2, 208, 520]
-[:mouse_move, 90, 706, 2, 209, 521]
-[:mouse_move, 89, 706, 2, 210, 523]
-[:mouse_move, 89, 707, 2, 211, 524]
-[:mouse_move, 94, 709, 2, 212, 525]
-[:mouse_move, 95, 710, 2, 213, 526]
-[:mouse_move, 101, 711, 2, 214, 527]
-[:mouse_move, 103, 712, 2, 215, 528]
-[:mouse_move, 106, 713, 2, 216, 529]
-[:mouse_move, 107, 713, 2, 217, 530]
-[:mouse_move, 108, 713, 2, 218, 531]
-[:mouse_move, 104, 713, 2, 219, 533]
-[:mouse_move, 99, 712, 2, 220, 534]
-[:mouse_move, 93, 711, 2, 221, 535]
-[:mouse_move, 90, 711, 2, 222, 536]
-[:mouse_move, 86, 711, 2, 223, 537]
-[:mouse_move, 84, 711, 2, 224, 538]
-[:mouse_move, 83, 711, 2, 225, 539]
-[:mouse_move, 85, 711, 2, 226, 542]
-[:mouse_move, 90, 711, 2, 227, 543]
-[:mouse_move, 92, 711, 2, 228, 544]
-[:mouse_move, 93, 711, 2, 229, 545]
-[:mouse_move, 95, 712, 2, 230, 546]
-[:mouse_move, 96, 712, 2, 231, 547]
-[:mouse_move, 97, 712, 2, 232, 554]
-[:mouse_move, 103, 712, 2, 233, 555]
-[:mouse_move, 118, 712, 2, 234, 556]
-[:mouse_move, 129, 712, 2, 235, 557]
-[:mouse_move, 153, 713, 2, 236, 558]
-[:mouse_move, 166, 715, 2, 237, 559]
-[:mouse_move, 183, 718, 2, 238, 560]
-[:mouse_move, 194, 719, 2, 239, 561]
-[:mouse_move, 216, 719, 2, 240, 562]
-[:mouse_move, 285, 718, 2, 241, 608]
-[:mouse_move, 285, 717, 2, 242, 609]
-[:mouse_move, 284, 715, 2, 243, 610]
-[:mouse_move, 284, 714, 2, 244, 611]
-[:mouse_move, 283, 713, 2, 245, 612]
-[:mouse_move, 283, 712, 2, 246, 614]
-[:mouse_move, 282, 712, 2, 247, 616]
-[:mouse_move, 283, 712, 2, 248, 631]
-[:mouse_move, 284, 712, 2, 249, 638]
-[:mouse_move, 285, 712, 2, 250, 645]
-[:mouse_move, 288, 711, 2, 251, 681]
-[:mouse_move, 296, 705, 2, 252, 682]
-[:mouse_move, 322, 683, 2, 253, 683]
-[:mouse_move, 343, 663, 2, 254, 684]
-[:mouse_move, 392, 617, 2, 255, 685]
-[:mouse_move, 421, 591, 2, 256, 686]
-[:mouse_move, 476, 539, 2, 257, 687]
-[:mouse_move, 502, 516, 2, 258, 688]
-[:mouse_move, 535, 485, 2, 259, 689]
-[:mouse_move, 571, 451, 2, 260, 690]
-[:mouse_move, 587, 435, 2, 261, 691]
-[:mouse_move, 616, 410, 2, 262, 692]
-[:mouse_move, 628, 398, 2, 263, 693]
-[:mouse_move, 641, 385, 2, 264, 694]
-[:mouse_move, 666, 360, 2, 265, 695]
-[:mouse_move, 677, 349, 2, 266, 696]
-[:mouse_move, 692, 333, 2, 267, 697]
-[:mouse_move, 700, 324, 2, 268, 698]
-[:mouse_move, 722, 299, 2, 269, 699]
-[:mouse_move, 730, 290, 2, 270, 700]
-[:mouse_move, 750, 269, 2, 271, 701]
-[:mouse_move, 760, 258, 2, 272, 702]
-[:mouse_move, 780, 238, 2, 273, 703]
-[:mouse_move, 785, 233, 2, 274, 704]
-[:mouse_move, 802, 217, 2, 275, 705]
-[:mouse_move, 816, 206, 2, 276, 706]
-[:mouse_move, 824, 198, 2, 277, 707]
-[:mouse_move, 846, 169, 2, 278, 708]
-[:mouse_move, 847, 169, 2, 279, 722]
-[:mouse_move, 854, 165, 2, 280, 723]
-[:mouse_move, 870, 154, 2, 281, 724]
-[:mouse_move, 877, 148, 2, 282, 725]
-[:mouse_move, 888, 137, 2, 283, 726]
-[:mouse_move, 894, 132, 2, 284, 727]
-[:mouse_move, 911, 119, 2, 285, 728]
-[:mouse_move, 920, 112, 2, 286, 729]
-[:mouse_move, 935, 99, 2, 287, 730]
-[:mouse_move, 941, 94, 2, 288, 731]
-[:mouse_move, 951, 85, 2, 289, 732]
-[:mouse_move, 955, 81, 2, 290, 733]
-[:mouse_move, 959, 77, 2, 291, 734]
-[:mouse_move, 961, 76, 2, 292, 735]
-[:mouse_move, 962, 74, 2, 293, 736]
-[:mouse_move, 963, 73, 2, 294, 737]
-[:mouse_move, 964, 72, 2, 295, 738]
-[:mouse_move, 964, 71, 2, 296, 739]
-[:mouse_move, 965, 69, 2, 297, 740]
-[:mouse_move, 965, 67, 2, 298, 741]
-[:mouse_move, 966, 65, 2, 299, 742]
-[:mouse_move, 968, 61, 2, 300, 743]
-[:mouse_move, 969, 58, 2, 301, 744]
-[:mouse_move, 972, 53, 2, 302, 745]
-[:mouse_move, 973, 51, 2, 303, 746]
-[:mouse_move, 975, 48, 2, 304, 747]
-[:mouse_move, 976, 46, 2, 305, 748]
-[:mouse_move, 979, 43, 2, 306, 749]
-[:mouse_move, 980, 42, 2, 307, 750]
-[:mouse_move, 983, 39, 2, 308, 751]
-[:mouse_move, 984, 38, 2, 309, 752]
-[:mouse_move, 987, 35, 2, 310, 753]
-[:mouse_move, 988, 34, 2, 311, 754]
-[:mouse_move, 990, 32, 2, 312, 755]
-[:mouse_move, 991, 32, 2, 313, 756]
-[:mouse_move, 992, 30, 2, 314, 757]
-[:mouse_move, 993, 28, 2, 315, 759]
-[:mouse_move, 993, 27, 2, 316, 760]
-[:mouse_move, 993, 25, 2, 317, 761]
-[:mouse_move, 993, 24, 2, 318, 762]
-[:mouse_move, 993, 23, 2, 319, 763]
-[:mouse_move, 993, 21, 2, 320, 764]
-[:mouse_move, 993, 20, 2, 321, 765]
-[:mouse_move, 993, 19, 2, 322, 766]
-[:mouse_move, 994, 18, 2, 323, 767]
-[:mouse_move, 994, 16, 2, 324, 768]
-[:mouse_move, 994, 14, 2, 325, 770]
-[:mouse_move, 995, 13, 2, 326, 772]
-[:mouse_move, 995, 12, 2, 327, 774]
-[:mouse_move, 995, 11, 2, 328, 776]
-[:mouse_move, 995, 10, 2, 329, 778]
-[:mouse_move, 996, 10, 2, 330, 781]
-[:mouse_move, 996, 9, 2, 331, 788]
-[:mouse_move, 996, 8, 2, 332, 793]
-[:key_down_raw, 1073742051, 1024, 2, 333, 986]
-[:key_down_raw, 113, 1024, 2, 334, 986]
-[:key_up_raw, 113, 1024, 2, 335, 986]
diff --git a/samples/19_lowrez_jam_02_buttons/app/main.rb b/samples/19_lowrez_jam_02_buttons/app/main.rb
deleted file mode 100644
index 406abbc..0000000
--- a/samples/19_lowrez_jam_02_buttons/app/main.rb
+++ /dev/null
@@ -1,219 +0,0 @@
-=begin
-
- Reminders:
-
- - args.outputs.lines: An array. The values generate a line.
- The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE, ALPHA]
- For more information about lines, go to mygame/documentation/04-lines.md.
-
- In this sample app, we're using lines to create the grid lines that make
- a 64x64 grid.
-
- - args.outputs.labels: An array. The values generate a label.
- The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]
- For more information about labels, go to mygame/documentation/02-labels.md.
-
- - args.outputs.solids: An array. The values generate a solid.
- The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]
- NOTE: PARAMETERS ARE THE SAME FOR BORDERS!
- For more information about solids and borders, go to mygame/documentation/03-solids-and-borders.md.
-
- - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated
- as Ruby code, and the placeholder is replaced with its corresponding value or result.
-
- - args.state.new_entity: Used when we want to create a new object, like a sprite or button.
- For example, if we want to create a new button, we would declare it as a new entity and
- then define its properties. (Remember, you can use state to define ANY property and it will
- be retained across frames.)
-
- - num1.idiv(num2): Divides two numbers and returns an integer.
-
- - num1.fdiv(num2): Divides two numbers and returns a float (has a decimal).
-
- - args.click.point.(x|y): The x and y location of the mouse.
- For more information about the mouse, go to mygame/documentation/07-mouse.md.
-
- - Symbol (:): Ruby object with a name and an internal ID. Symbols are useful
- because with a given symbol name, you can refer to the same object throughout
- a Ruby program.
-
-=end
-
-# This sample app shows two buttons. A label outputs a message depending on
-# which button has been pressed.
-
-# https://twitter.com/hashtag/LOWREZJAM
-
-###################################################################################
-# YOUR GAME GOES HERE
-###################################################################################
-
-# Creates buttons using labels and borders and reacts accordingly based on which button is pressed.
-def lowrez_tick args, lowrez_sprites, lowrez_labels, lowrez_borders, lowrez_solids, lowrez_mouse
- # args.state.show_gridlines = true
-
- # Creates a white label telling the player to press a button.
- # The message is initialized (only in the first frame)
- args.state.button_message ||= "press button!"
- lowrez_labels << [1, 1, args.state.button_message, 255, 255, 255]
-
- # Creates button one using a border and a label
- button_one_border = [1, 32, 63, 10, 255, 255, 255] # white border
- lowrez_borders << button_one_border
- lowrez_labels << [button_one_border.x + 2,
- button_one_border.y + 2,
- "button one", 255, 255, 255] # white label
-
- # Creates button two using a border and a label
- button_two_border = [1, 21, 63, 10, 255, 255, 255] # white border
- lowrez_borders << button_two_border
- lowrez_labels << [button_two_border.x + 2,
- button_two_border.y + 2,
- "button two", 255, 255, 255] # white label
-
- if args.state.last_button_clicked # if a button was clicked (that button is last_button_clicked)
- lowrez_solids << [args.state.last_button_clicked.rect, 127, 127, 127] # button turns shade of gray
- end
-
- if lowrez_mouse.click # if the mouse was clicked
- if lowrez_mouse.click.inside_rect? button_one_border # if mouse clicked inside button one's border
- args.state.button_message = "button one!" # button message is set
- args.state.last_button_clicked = button_one_border # button one is last button clicked
- elsif lowrez_mouse.click.inside_rect? button_two_border # if mouse clicked inside button two's border
- args.state.button_message = "button two!" # button message is set
- args.state.last_button_clicked = button_two_border # button two is last button clicked
- else # if mouse was clicked inside border of neither button
- args.state.button_message = "press button!" # button message is set
- args.state.last_button_clicked = nil # no button was last button clicked
- end
- end
-end
-
-###################################################################################
-# YOU CAN PLAY AROUND WITH THE CODE BELOW, BUT USE CAUTION AS THIS IS WHAT EMULATES
-# THE 64x64 CANVAS.
-###################################################################################
-
-# Sets values to produce 64x64 canvas.
-# These values are not changed, which is why ||= is not used.
-TINY_RESOLUTION = 64
-TINY_SCALE = 720.fdiv(TINY_RESOLUTION) # original dimension of 720 is scaled down by 64
-CENTER_OFFSET = (1280 - 720).fdiv(2) # sets center
-EMULATED_FONT_SIZE = 20
-EMULATED_FONT_X_ZERO = 0 # increasing this value would shift labels to the right
-EMULATED_FONT_Y_ZERO = 46 # increasing shifts labels up, decreasing shifts labels down
-
-# Creates empty collections, and calls methods needed for the game to run properly.
-def tick args
- sprites = []
- labels = []
- borders = []
- solids = []
- mouse = emulate_lowrez_mouse args # calls method to set mouse to mouse's position
- args.state.show_gridlines = false # grid lines are not shown
- lowrez_tick args, sprites, labels, borders, solids, mouse # contains definitions (of buttons)
- render_gridlines_if_needed args # outputs grid lines if show_gridlines is true
- render_mouse_crosshairs args, mouse # outputs position of mouse using label
- emulate_lowrez_scene args, sprites, labels, borders, solids, mouse # emulates scene on screen
-end
-
-# Sets values based on the position of the mouse on the screen.
-def emulate_lowrez_mouse args
-
- # Declares the mouse as a new entity and sets values for the x and y variables.
- args.state.new_entity_strict(:lowrez_mouse) do |m|
- # mouse's original coordinates are scaled down to match canvas
- # original coordinates were within 1280x720 dimensions
- m.x = args.mouse.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1
- m.y = args.mouse.y.idiv(TINY_SCALE)
-
- if args.mouse.click # if mouse is clicked
- m.click = [ # sets definition and stores mouse click's definition
- args.mouse.click.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1,
- args.mouse.click.point.y.idiv(TINY_SCALE)
- ]
- m.down = m.click # down stores click's value, which is mouse click's position
- else
- m.click = nil # if no click occurred, both click and down are empty (do not store any position)
- m.down = nil
- end
-
- if args.mouse.up # if mouse is up (not pressed or held down)
- m.up = [ # sets definition, stores mouse's position
- args.mouse.up.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1,
- args.mouse.up.point.y.idiv(TINY_SCALE)
- ]
- else
- m.up = nil # if mouse is not in "up" state, up is empty (has no value)
- end
- end
-end
-
-# Outputs position of mouse on screen using white label
-def render_mouse_crosshairs args, mouse
- return unless args.state.show_gridlines # return unless true (grid lines are showing)
- args.labels << [10, 25, "mouse: #{mouse.x} #{mouse.y}", 255, 255, 255] # string interpolation
-end
-
-#Emulates the low rez scene by adding solids, sprites, etc. to the appropriate collections
-# and creating labels
-def emulate_lowrez_scene args, sprites, labels, borders, solids, mouse
- args.render_target(:lowrez).solids << [0, 0, 1280, 720] # sets black background for grid
- args.render_target(:lowrez).sprites << sprites # outputs sprites
- args.render_target(:lowrez).borders << borders # outputs borders
- args.render_target(:lowrez).solids << solids # outputs solids
-
- # The font that is used is saved in the game's folder.
- # Without the .ttf file, the label would not be created correctly.
- args.outputs.primitives << labels.map do |l| # outputs all elements of labels collection as primitive
- as_label = l.label
- l.text.each_char.each_with_index.map do |char, i| # perform action on each character in labels collection
- # label definition
- # places space between characters
- # centered to fit within grid dimensions
- [CENTER_OFFSET + EMULATED_FONT_X_ZERO + (as_label.x * TINY_SCALE) + i * 5 * TINY_SCALE,
- EMULATED_FONT_Y_ZERO + (as_label.y * TINY_SCALE), char,
- EMULATED_FONT_SIZE, 0, as_label.r, as_label.g, as_label.b, as_label.a, 'dragonruby-gtk-4x4.ttf'].label
- end
- end
-
- # placed in center; width and height are scaled down to fit canvas
- # comment this line out and the grid's black background will not appear
- args.sprites << [CENTER_OFFSET, 0, 1280 * TINY_SCALE, 720 * TINY_SCALE, :lowrez]
-
- args.primitives << [0, 0, CENTER_OFFSET, 720].solid # black background on left side of grid
- args.primitives << [1280 - CENTER_OFFSET, 0, CENTER_OFFSET, 720].solid # black on right side of grid
- args.primitives << [0, 0, 1280, 2].solid # black on bottom; change 2 to 200 and see what happens
-end
-
-def render_gridlines_if_needed args
- # if grid lines are showing and static_lines collection (which contains grid lines) is empty
- if args.state.show_gridlines && args.static_lines.length == 0
- # add to the collection by adding line definitions 65 times (because of 64x64 canvas)
- # placed at equal distance apart within grid dimensions
- args.static_lines << 65.times.map do |i|
- [
- # [starting x, starting y, ending x, ending y, red, green, blue]
- # Vertical lines have the same starting and ending x value.
- # To make the vertical grid lines look thicker and more prominent, two separators are
- # placed together one pixel apart (explains "+1" in x parameter) as one vertical grid line.
- [CENTER_OFFSET + i * TINY_SCALE + 1, 0,
- CENTER_OFFSET + i * TINY_SCALE + 1, 720, 128, 128, 128], # vertical line 1
- [CENTER_OFFSET + i * TINY_SCALE, 0,
- CENTER_OFFSET + i * TINY_SCALE, 720, 128, 128, 128], # vertical line 2
- # Horizontal lines have the same starting and ending y value.
- # The two horizontal separators that are considered one grid line are placed
- # one pixel apart (explains the "1 +" in the y parameter).
- # That is why there are four line definitions (distinguished by []) being added to static_lines.
- # Two vertical and two horizontal separators are added to create one vertical
- # and one horizontal grid line.
- [CENTER_OFFSET, 0 + i * TINY_SCALE,
- CENTER_OFFSET + 720, 0 + i * TINY_SCALE, 128, 128, 128], # horizontal line 1
- [CENTER_OFFSET, 1 + i * TINY_SCALE,
- CENTER_OFFSET + 720, 1 + i * TINY_SCALE, 128, 128, 128] # horizontal line 2
- ]
- end
- elsif !args.state.show_gridlines # if show_gridlines is false (grid lines are not showing)
- args.static_lines.clear # clear the collection so no grid lines are in it
- end
-end
diff --git a/samples/19_lowrez_jam_02_buttons/dragonruby-gtk-4x4.ttf b/samples/19_lowrez_jam_02_buttons/dragonruby-gtk-4x4.ttf
deleted file mode 100644
index 24cc711..0000000
--- a/samples/19_lowrez_jam_02_buttons/dragonruby-gtk-4x4.ttf
+++ /dev/null
Binary files differ
diff --git a/samples/19_lowrez_jam_02_buttons/license-for-sample.txt b/samples/19_lowrez_jam_02_buttons/license-for-sample.txt
deleted file mode 100644
index 100dcec..0000000
--- a/samples/19_lowrez_jam_02_buttons/license-for-sample.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-Copyright 2019 DragonRuby LLC
-
-MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/samples/19_lowrez_jam_02_buttons/replay.txt b/samples/19_lowrez_jam_02_buttons/replay.txt
deleted file mode 100644
index 8b3d97c..0000000
--- a/samples/19_lowrez_jam_02_buttons/replay.txt
+++ /dev/null
@@ -1,456 +0,0 @@
-replay_version 2.0
-stopped_at 753
-seed 100
-recorded_at Sun Sep 29 22:37:16 2019
-[:mouse_move, 991, 8, 2, 1, 51]
-[:mouse_move, 985, 8, 2, 2, 52]
-[:mouse_move, 975, 8, 2, 3, 53]
-[:mouse_move, 971, 9, 2, 4, 54]
-[:mouse_move, 960, 15, 2, 5, 55]
-[:mouse_move, 953, 18, 2, 6, 56]
-[:mouse_move, 911, 41, 2, 7, 57]
-[:mouse_move, 889, 53, 2, 8, 58]
-[:mouse_move, 833, 85, 2, 9, 59]
-[:mouse_move, 798, 101, 2, 10, 60]
-[:mouse_move, 697, 151, 2, 11, 61]
-[:mouse_move, 679, 160, 2, 12, 62]
-[:mouse_move, 643, 179, 2, 13, 63]
-[:mouse_move, 601, 202, 2, 14, 64]
-[:mouse_move, 579, 214, 2, 15, 65]
-[:mouse_move, 539, 235, 2, 16, 66]
-[:mouse_move, 522, 244, 2, 17, 67]
-[:mouse_move, 487, 258, 2, 18, 68]
-[:mouse_move, 470, 263, 2, 19, 69]
-[:mouse_move, 436, 271, 2, 20, 70]
-[:mouse_move, 417, 274, 2, 21, 71]
-[:mouse_move, 382, 277, 2, 22, 72]
-[:mouse_move, 366, 278, 2, 23, 73]
-[:mouse_move, 339, 279, 2, 24, 74]
-[:mouse_move, 334, 279, 2, 25, 75]
-[:mouse_move, 320, 280, 2, 26, 76]
-[:mouse_move, 313, 281, 2, 27, 77]
-[:mouse_move, 306, 282, 2, 28, 78]
-[:mouse_move, 304, 283, 2, 29, 79]
-[:mouse_move, 302, 284, 2, 30, 80]
-[:mouse_move, 302, 285, 2, 31, 81]
-[:mouse_move, 310, 288, 2, 32, 82]
-[:mouse_move, 320, 292, 2, 33, 83]
-[:mouse_move, 355, 301, 2, 34, 84]
-[:mouse_move, 376, 307, 2, 35, 85]
-[:mouse_move, 410, 313, 2, 36, 86]
-[:mouse_move, 419, 314, 2, 37, 87]
-[:mouse_move, 435, 316, 2, 38, 88]
-[:mouse_move, 444, 317, 2, 39, 89]
-[:mouse_move, 450, 318, 2, 40, 90]
-[:mouse_move, 457, 318, 2, 41, 91]
-[:mouse_move, 459, 319, 2, 42, 92]
-[:mouse_move, 462, 320, 2, 43, 93]
-[:mouse_move, 463, 322, 2, 44, 94]
-[:mouse_move, 465, 334, 2, 45, 95]
-[:mouse_move, 465, 350, 2, 46, 96]
-[:mouse_move, 465, 420, 2, 47, 97]
-[:mouse_move, 462, 516, 2, 48, 98]
-[:mouse_move, 460, 647, 2, 49, 99]
-[:mouse_move, 460, 679, 2, 50, 100]
-[:mouse_move, 450, 679, 2, 51, 113]
-[:mouse_move, 441, 680, 2, 52, 114]
-[:mouse_move, 417, 684, 2, 53, 115]
-[:mouse_move, 402, 687, 2, 54, 116]
-[:mouse_move, 368, 695, 2, 55, 117]
-[:mouse_move, 356, 699, 2, 56, 118]
-[:mouse_move, 336, 704, 2, 57, 119]
-[:mouse_move, 300, 713, 2, 58, 120]
-[:mouse_move, 294, 715, 2, 59, 121]
-[:mouse_move, 273, 717, 2, 60, 122]
-[:mouse_move, 270, 717, 2, 61, 123]
-[:mouse_move, 260, 717, 2, 62, 124]
-[:mouse_move, 258, 717, 2, 63, 125]
-[:mouse_move, 255, 717, 2, 64, 126]
-[:mouse_move, 254, 717, 2, 65, 128]
-[:mouse_move, 257, 717, 2, 66, 131]
-[:mouse_move, 264, 718, 2, 67, 132]
-[:mouse_move, 268, 718, 2, 68, 133]
-[:mouse_move, 279, 719, 2, 69, 134]
-[:mouse_move, 285, 719, 2, 70, 135]
-[:mouse_move, 298, 719, 2, 71, 136]
-[:mouse_move, 304, 719, 2, 72, 137]
-[:mouse_move, 315, 718, 2, 73, 138]
-[:mouse_move, 321, 717, 2, 74, 139]
-[:mouse_move, 334, 715, 2, 75, 140]
-[:mouse_move, 340, 713, 2, 76, 141]
-[:mouse_move, 351, 710, 2, 77, 142]
-[:mouse_move, 358, 708, 2, 78, 143]
-[:mouse_move, 371, 704, 2, 79, 144]
-[:mouse_move, 378, 702, 2, 80, 145]
-[:mouse_move, 384, 700, 2, 81, 146]
-[:mouse_move, 391, 697, 2, 82, 147]
-[:mouse_move, 394, 697, 2, 83, 148]
-[:mouse_move, 400, 696, 2, 84, 149]
-[:mouse_move, 401, 696, 2, 85, 150]
-[:mouse_move, 404, 695, 2, 86, 151]
-[:mouse_move, 405, 695, 2, 87, 152]
-[:mouse_move, 409, 695, 2, 88, 153]
-[:mouse_move, 412, 695, 2, 89, 154]
-[:mouse_move, 419, 695, 2, 90, 155]
-[:mouse_move, 423, 695, 2, 91, 156]
-[:mouse_move, 432, 695, 2, 92, 157]
-[:mouse_move, 436, 695, 2, 93, 158]
-[:mouse_move, 445, 695, 2, 94, 159]
-[:mouse_move, 448, 695, 2, 95, 160]
-[:mouse_move, 457, 695, 2, 96, 161]
-[:mouse_move, 462, 695, 2, 97, 162]
-[:mouse_move, 474, 695, 2, 98, 163]
-[:mouse_move, 485, 695, 2, 99, 164]
-[:mouse_move, 502, 695, 2, 100, 165]
-[:mouse_move, 507, 695, 2, 101, 166]
-[:mouse_move, 532, 695, 2, 102, 167]
-[:mouse_move, 541, 694, 2, 103, 168]
-[:mouse_move, 563, 693, 2, 104, 169]
-[:mouse_move, 574, 693, 2, 105, 170]
-[:mouse_move, 597, 693, 2, 106, 171]
-[:mouse_move, 609, 693, 2, 107, 172]
-[:mouse_move, 621, 693, 2, 108, 173]
-[:mouse_move, 646, 693, 2, 109, 174]
-[:mouse_move, 659, 693, 2, 110, 175]
-[:mouse_move, 685, 693, 2, 111, 176]
-[:mouse_move, 700, 693, 2, 112, 177]
-[:mouse_move, 727, 693, 2, 113, 178]
-[:mouse_move, 741, 693, 2, 114, 179]
-[:mouse_move, 758, 693, 2, 115, 180]
-[:mouse_move, 769, 693, 2, 116, 181]
-[:mouse_move, 791, 693, 2, 117, 182]
-[:mouse_move, 799, 693, 2, 118, 183]
-[:mouse_move, 814, 693, 2, 119, 184]
-[:mouse_move, 820, 693, 2, 120, 185]
-[:mouse_move, 832, 693, 2, 121, 186]
-[:mouse_move, 837, 693, 2, 122, 187]
-[:mouse_move, 847, 693, 2, 123, 188]
-[:mouse_move, 853, 693, 2, 124, 189]
-[:mouse_move, 863, 691, 2, 125, 190]
-[:mouse_move, 868, 690, 2, 126, 191]
-[:mouse_move, 875, 689, 2, 127, 192]
-[:mouse_move, 881, 689, 2, 128, 193]
-[:mouse_move, 889, 689, 2, 129, 194]
-[:mouse_move, 892, 689, 2, 130, 195]
-[:mouse_move, 897, 689, 2, 131, 196]
-[:mouse_move, 899, 689, 2, 132, 197]
-[:mouse_move, 904, 690, 2, 133, 198]
-[:mouse_move, 905, 690, 2, 134, 199]
-[:mouse_move, 906, 690, 2, 135, 200]
-[:mouse_move, 908, 690, 2, 136, 201]
-[:mouse_move, 909, 690, 2, 137, 202]
-[:mouse_move, 910, 690, 2, 138, 203]
-[:mouse_move, 910, 688, 2, 139, 221]
-[:mouse_move, 897, 665, 2, 140, 222]
-[:mouse_move, 858, 611, 2, 141, 223]
-[:mouse_move, 832, 577, 2, 142, 224]
-[:mouse_move, 801, 537, 2, 143, 225]
-[:mouse_move, 783, 514, 2, 144, 226]
-[:mouse_move, 754, 477, 2, 145, 227]
-[:mouse_move, 730, 449, 2, 146, 228]
-[:mouse_move, 715, 433, 2, 147, 229]
-[:mouse_move, 701, 417, 2, 148, 230]
-[:mouse_move, 694, 409, 2, 149, 231]
-[:mouse_move, 684, 395, 2, 150, 232]
-[:mouse_move, 680, 390, 2, 151, 233]
-[:mouse_move, 675, 380, 2, 152, 234]
-[:mouse_move, 671, 372, 2, 153, 236]
-[:mouse_move, 671, 370, 2, 154, 237]
-[:mouse_move, 670, 366, 2, 155, 238]
-[:mouse_move, 669, 364, 2, 156, 239]
-[:mouse_move, 667, 360, 2, 157, 240]
-[:mouse_move, 666, 356, 2, 158, 241]
-[:mouse_move, 663, 348, 2, 159, 242]
-[:mouse_move, 663, 345, 2, 160, 243]
-[:mouse_move, 660, 334, 2, 161, 244]
-[:mouse_move, 659, 332, 2, 162, 245]
-[:mouse_move, 657, 325, 2, 163, 246]
-[:mouse_move, 656, 322, 2, 164, 247]
-[:mouse_move, 655, 317, 2, 165, 248]
-[:mouse_move, 655, 315, 2, 166, 249]
-[:mouse_move, 655, 312, 2, 167, 250]
-[:mouse_move, 655, 311, 2, 168, 251]
-[:mouse_move, 655, 310, 2, 169, 252]
-[:mouse_button_pressed, 1, 0, 1, 170, 253]
-[:mouse_move, 654, 310, 2, 171, 253]
-[:mouse_button_up, 1, 0, 1, 172, 261]
-[:mouse_move, 654, 311, 2, 173, 296]
-[:mouse_move, 654, 314, 2, 174, 297]
-[:mouse_move, 654, 336, 2, 175, 298]
-[:mouse_move, 652, 351, 2, 176, 299]
-[:mouse_move, 639, 399, 2, 177, 300]
-[:mouse_move, 627, 425, 2, 178, 301]
-[:mouse_move, 595, 482, 2, 179, 302]
-[:mouse_move, 573, 510, 2, 180, 303]
-[:mouse_move, 525, 555, 2, 181, 304]
-[:mouse_move, 501, 574, 2, 182, 305]
-[:mouse_move, 468, 592, 2, 183, 306]
-[:mouse_move, 447, 602, 2, 184, 307]
-[:mouse_move, 410, 615, 2, 185, 308]
-[:mouse_move, 394, 620, 2, 186, 309]
-[:mouse_move, 389, 621, 2, 187, 310]
-[:mouse_move, 368, 627, 2, 188, 311]
-[:mouse_move, 361, 630, 2, 189, 312]
-[:mouse_move, 348, 634, 2, 190, 313]
-[:mouse_move, 342, 636, 2, 191, 314]
-[:mouse_move, 332, 641, 2, 192, 315]
-[:mouse_move, 327, 643, 2, 193, 316]
-[:mouse_move, 318, 650, 2, 194, 317]
-[:mouse_move, 313, 653, 2, 195, 318]
-[:mouse_move, 303, 662, 2, 196, 319]
-[:mouse_move, 299, 667, 2, 197, 320]
-[:mouse_move, 291, 676, 2, 198, 321]
-[:mouse_move, 288, 680, 2, 199, 322]
-[:mouse_move, 284, 685, 2, 200, 323]
-[:mouse_move, 282, 688, 2, 201, 324]
-[:mouse_move, 281, 691, 2, 202, 325]
-[:mouse_move, 280, 691, 2, 203, 326]
-[:mouse_move, 280, 692, 2, 204, 327]
-[:mouse_move, 285, 692, 2, 205, 329]
-[:mouse_move, 292, 691, 2, 206, 330]
-[:mouse_move, 305, 690, 2, 207, 331]
-[:mouse_move, 319, 690, 2, 208, 332]
-[:mouse_move, 345, 690, 2, 209, 333]
-[:mouse_move, 358, 692, 2, 210, 334]
-[:mouse_move, 383, 699, 2, 211, 335]
-[:mouse_move, 412, 708, 2, 212, 336]
-[:mouse_move, 432, 713, 2, 213, 337]
-[:mouse_move, 472, 719, 2, 214, 338]
-[:mouse_move, 670, 719, 2, 215, 346]
-[:mouse_move, 682, 717, 2, 216, 347]
-[:mouse_move, 689, 717, 2, 217, 347]
-[:mouse_move, 700, 715, 2, 218, 348]
-[:mouse_move, 710, 715, 2, 219, 349]
-[:mouse_move, 727, 712, 2, 220, 350]
-[:mouse_move, 735, 711, 2, 221, 351]
-[:mouse_move, 749, 708, 2, 222, 352]
-[:mouse_move, 756, 706, 2, 223, 353]
-[:mouse_move, 768, 704, 2, 224, 354]
-[:mouse_move, 771, 703, 2, 225, 355]
-[:mouse_move, 778, 701, 2, 226, 356]
-[:mouse_move, 781, 701, 2, 227, 357]
-[:mouse_move, 785, 700, 2, 228, 358]
-[:mouse_move, 789, 700, 2, 229, 359]
-[:mouse_move, 793, 700, 2, 230, 360]
-[:mouse_move, 794, 700, 2, 231, 361]
-[:mouse_move, 798, 700, 2, 232, 362]
-[:mouse_move, 802, 700, 2, 233, 363]
-[:mouse_move, 805, 700, 2, 234, 364]
-[:mouse_move, 808, 700, 2, 235, 365]
-[:mouse_move, 811, 700, 2, 236, 366]
-[:mouse_move, 813, 700, 2, 237, 366]
-[:mouse_move, 815, 700, 2, 238, 367]
-[:mouse_move, 817, 700, 2, 239, 368]
-[:mouse_move, 819, 699, 2, 240, 368]
-[:mouse_move, 820, 699, 2, 241, 369]
-[:mouse_move, 822, 699, 2, 242, 370]
-[:mouse_move, 823, 699, 2, 243, 371]
-[:mouse_move, 824, 699, 2, 244, 372]
-[:mouse_move, 824, 698, 2, 245, 393]
-[:mouse_move, 823, 697, 2, 246, 393]
-[:mouse_move, 820, 692, 2, 247, 394]
-[:mouse_move, 816, 687, 2, 248, 395]
-[:mouse_move, 808, 673, 2, 249, 395]
-[:mouse_move, 799, 656, 2, 250, 396]
-[:mouse_move, 789, 634, 2, 251, 397]
-[:mouse_move, 777, 610, 2, 252, 397]
-[:mouse_move, 764, 581, 2, 253, 398]
-[:mouse_move, 747, 549, 2, 254, 399]
-[:mouse_move, 728, 515, 2, 255, 399]
-[:mouse_move, 719, 502, 2, 256, 400]
-[:mouse_move, 703, 478, 2, 257, 401]
-[:mouse_move, 689, 459, 2, 258, 401]
-[:mouse_move, 684, 453, 2, 259, 402]
-[:mouse_move, 674, 440, 2, 260, 403]
-[:mouse_move, 666, 430, 2, 261, 403]
-[:mouse_move, 659, 423, 2, 262, 404]
-[:mouse_move, 654, 417, 2, 263, 405]
-[:mouse_move, 648, 410, 2, 264, 406]
-[:mouse_move, 646, 408, 2, 265, 407]
-[:mouse_move, 642, 405, 2, 266, 408]
-[:mouse_move, 641, 403, 2, 267, 409]
-[:mouse_move, 640, 403, 2, 268, 410]
-[:mouse_move, 639, 403, 2, 269, 411]
-[:mouse_move, 638, 405, 2, 270, 418]
-[:mouse_move, 638, 406, 2, 271, 418]
-[:mouse_move, 638, 408, 2, 272, 419]
-[:mouse_move, 638, 410, 2, 273, 420]
-[:mouse_move, 637, 411, 2, 274, 420]
-[:mouse_move, 637, 413, 2, 275, 421]
-[:mouse_move, 636, 414, 2, 276, 422]
-[:mouse_move, 636, 416, 2, 277, 422]
-[:mouse_move, 635, 417, 2, 278, 423]
-[:mouse_move, 634, 418, 2, 279, 424]
-[:mouse_move, 633, 420, 2, 280, 424]
-[:mouse_move, 633, 421, 2, 281, 425]
-[:mouse_move, 632, 422, 2, 282, 426]
-[:mouse_move, 632, 423, 2, 283, 426]
-[:mouse_move, 631, 423, 2, 284, 427]
-[:mouse_move, 631, 424, 2, 285, 428]
-[:mouse_move, 631, 425, 2, 286, 429]
-[:mouse_button_pressed, 1, 0, 1, 287, 430]
-[:mouse_move, 630, 425, 2, 288, 430]
-[:mouse_button_up, 1, 0, 1, 289, 439]
-[:mouse_move, 626, 430, 2, 290, 454]
-[:mouse_move, 619, 439, 2, 291, 455]
-[:mouse_move, 592, 466, 2, 292, 456]
-[:mouse_move, 572, 487, 2, 293, 457]
-[:mouse_move, 512, 541, 2, 294, 458]
-[:mouse_move, 479, 569, 2, 295, 459]
-[:mouse_move, 420, 614, 2, 296, 460]
-[:mouse_move, 409, 621, 2, 297, 461]
-[:mouse_move, 381, 636, 2, 298, 462]
-[:mouse_move, 367, 642, 2, 299, 463]
-[:mouse_move, 348, 649, 2, 300, 464]
-[:mouse_move, 340, 652, 2, 301, 465]
-[:mouse_move, 328, 655, 2, 302, 466]
-[:mouse_move, 324, 656, 2, 303, 467]
-[:mouse_move, 318, 658, 2, 304, 468]
-[:mouse_move, 315, 659, 2, 305, 469]
-[:mouse_move, 312, 660, 2, 306, 470]
-[:mouse_move, 311, 661, 2, 307, 471]
-[:mouse_move, 309, 662, 2, 308, 473]
-[:mouse_move, 308, 665, 2, 309, 474]
-[:mouse_move, 307, 667, 2, 310, 475]
-[:mouse_move, 306, 670, 2, 311, 476]
-[:mouse_move, 303, 676, 2, 312, 477]
-[:mouse_move, 303, 677, 2, 313, 478]
-[:mouse_move, 302, 681, 2, 314, 479]
-[:mouse_move, 301, 683, 2, 315, 480]
-[:mouse_move, 301, 685, 2, 316, 481]
-[:mouse_move, 302, 686, 2, 317, 484]
-[:mouse_move, 306, 686, 2, 318, 485]
-[:mouse_move, 309, 686, 2, 319, 486]
-[:mouse_move, 316, 686, 2, 320, 487]
-[:mouse_move, 324, 686, 2, 321, 488]
-[:mouse_move, 340, 687, 2, 322, 489]
-[:mouse_move, 349, 687, 2, 323, 490]
-[:mouse_move, 371, 687, 2, 324, 491]
-[:mouse_move, 376, 687, 2, 325, 492]
-[:mouse_move, 396, 687, 2, 326, 493]
-[:mouse_move, 413, 687, 2, 327, 494]
-[:mouse_move, 433, 687, 2, 328, 495]
-[:mouse_move, 445, 687, 2, 329, 496]
-[:mouse_move, 472, 685, 2, 330, 497]
-[:mouse_move, 486, 684, 2, 331, 498]
-[:mouse_move, 501, 682, 2, 332, 499]
-[:mouse_move, 518, 680, 2, 333, 500]
-[:mouse_move, 528, 680, 2, 334, 501]
-[:mouse_move, 554, 678, 2, 335, 502]
-[:mouse_move, 564, 678, 2, 336, 503]
-[:mouse_move, 584, 678, 2, 337, 504]
-[:mouse_move, 597, 677, 2, 338, 505]
-[:mouse_move, 626, 675, 2, 339, 506]
-[:mouse_move, 642, 673, 2, 340, 507]
-[:mouse_move, 674, 670, 2, 341, 508]
-[:mouse_move, 681, 669, 2, 342, 509]
-[:mouse_move, 707, 668, 2, 343, 510]
-[:mouse_move, 725, 668, 2, 344, 511]
-[:mouse_move, 739, 668, 2, 345, 512]
-[:mouse_move, 748, 668, 2, 346, 513]
-[:mouse_move, 772, 668, 2, 347, 514]
-[:mouse_move, 782, 668, 2, 348, 515]
-[:mouse_move, 796, 668, 2, 349, 516]
-[:mouse_move, 805, 668, 2, 350, 517]
-[:mouse_move, 820, 667, 2, 351, 518]
-[:mouse_move, 822, 667, 2, 352, 519]
-[:mouse_move, 831, 667, 2, 353, 520]
-[:mouse_move, 833, 667, 2, 354, 521]
-[:mouse_move, 835, 667, 2, 355, 522]
-[:mouse_move, 836, 667, 2, 356, 523]
-[:mouse_move, 836, 666, 2, 357, 536]
-[:mouse_move, 829, 659, 2, 358, 537]
-[:mouse_move, 822, 653, 2, 359, 538]
-[:mouse_move, 803, 635, 2, 360, 539]
-[:mouse_move, 790, 626, 2, 361, 540]
-[:mouse_move, 766, 610, 2, 362, 541]
-[:mouse_move, 755, 604, 2, 363, 542]
-[:mouse_move, 739, 599, 2, 364, 543]
-[:mouse_move, 724, 595, 2, 365, 544]
-[:mouse_move, 717, 593, 2, 366, 545]
-[:mouse_move, 715, 593, 2, 367, 546]
-[:mouse_move, 710, 593, 2, 368, 547]
-[:mouse_move, 705, 592, 2, 369, 548]
-[:mouse_move, 703, 592, 2, 370, 549]
-[:mouse_move, 702, 592, 2, 371, 550]
-[:mouse_move, 701, 592, 2, 372, 551]
-[:mouse_button_pressed, 1, 0, 1, 373, 564]
-[:mouse_button_up, 1, 0, 1, 374, 572]
-[:mouse_move, 698, 592, 2, 375, 593]
-[:mouse_move, 693, 592, 2, 376, 594]
-[:mouse_move, 678, 590, 2, 377, 595]
-[:mouse_move, 660, 589, 2, 378, 596]
-[:mouse_move, 633, 589, 2, 379, 597]
-[:mouse_move, 601, 589, 2, 380, 598]
-[:mouse_move, 553, 597, 2, 381, 599]
-[:mouse_move, 528, 601, 2, 382, 600]
-[:mouse_move, 495, 609, 2, 383, 601]
-[:mouse_move, 475, 613, 2, 384, 602]
-[:mouse_move, 435, 621, 2, 385, 603]
-[:mouse_move, 416, 624, 2, 386, 604]
-[:mouse_move, 385, 632, 2, 387, 605]
-[:mouse_move, 378, 634, 2, 388, 606]
-[:mouse_move, 356, 641, 2, 389, 607]
-[:mouse_move, 349, 644, 2, 390, 608]
-[:mouse_move, 342, 647, 2, 391, 609]
-[:mouse_move, 333, 654, 2, 392, 610]
-[:mouse_move, 326, 660, 2, 393, 611]
-[:mouse_move, 323, 663, 2, 394, 612]
-[:mouse_move, 322, 665, 2, 395, 613]
-[:mouse_move, 319, 669, 2, 396, 614]
-[:mouse_move, 318, 671, 2, 397, 615]
-[:mouse_move, 317, 673, 2, 398, 616]
-[:mouse_move, 317, 674, 2, 399, 618]
-[:mouse_move, 317, 675, 2, 400, 620]
-[:mouse_move, 317, 676, 2, 401, 622]
-[:mouse_move, 319, 676, 2, 402, 624]
-[:mouse_move, 321, 677, 2, 403, 625]
-[:mouse_move, 331, 678, 2, 404, 626]
-[:mouse_move, 338, 678, 2, 405, 627]
-[:mouse_move, 357, 680, 2, 406, 628]
-[:mouse_move, 369, 680, 2, 407, 629]
-[:mouse_move, 396, 682, 2, 408, 630]
-[:mouse_move, 409, 683, 2, 409, 631]
-[:mouse_move, 437, 684, 2, 410, 632]
-[:mouse_move, 450, 685, 2, 411, 633]
-[:mouse_move, 465, 686, 2, 412, 634]
-[:mouse_move, 491, 686, 2, 413, 635]
-[:mouse_move, 506, 686, 2, 414, 636]
-[:mouse_move, 533, 686, 2, 415, 637]
-[:mouse_move, 546, 686, 2, 416, 638]
-[:mouse_move, 575, 684, 2, 417, 639]
-[:mouse_move, 590, 682, 2, 418, 640]
-[:mouse_move, 617, 677, 2, 419, 641]
-[:mouse_move, 631, 675, 2, 420, 642]
-[:mouse_move, 656, 671, 2, 421, 643]
-[:mouse_move, 669, 670, 2, 422, 644]
-[:mouse_move, 697, 667, 2, 423, 645]
-[:mouse_move, 711, 667, 2, 424, 646]
-[:mouse_move, 743, 666, 2, 425, 647]
-[:mouse_move, 769, 666, 2, 426, 648]
-[:mouse_move, 794, 666, 2, 427, 649]
-[:mouse_move, 808, 666, 2, 428, 650]
-[:mouse_move, 840, 666, 2, 429, 651]
-[:mouse_move, 854, 666, 2, 430, 652]
-[:mouse_move, 880, 666, 2, 431, 653]
-[:mouse_move, 891, 667, 2, 432, 654]
-[:mouse_move, 905, 668, 2, 433, 655]
-[:mouse_move, 908, 668, 2, 434, 656]
-[:mouse_move, 918, 669, 2, 435, 657]
-[:mouse_move, 921, 670, 2, 436, 658]
-[:mouse_move, 926, 671, 2, 437, 659]
-[:mouse_move, 928, 671, 2, 438, 660]
-[:mouse_move, 931, 671, 2, 439, 661]
-[:mouse_move, 932, 672, 2, 440, 662]
-[:mouse_move, 933, 672, 2, 441, 663]
-[:mouse_move, 934, 672, 2, 442, 664]
-[:mouse_move, 935, 672, 2, 443, 672]
-[:mouse_move, 935, 670, 2, 444, 676]
-[:mouse_move, 933, 666, 2, 445, 677]
-[:mouse_move, 927, 651, 2, 446, 678]
-[:mouse_move, 925, 646, 2, 447, 679]
-[:mouse_move, 921, 637, 2, 448, 680]
-[:mouse_move, 919, 633, 2, 449, 681]
-[:mouse_move, 916, 627, 2, 450, 682]
-[:key_down_raw, 1073742051, 1024, 2, 451, 752]
-[:key_down_raw, 113, 1024, 2, 452, 752]
diff --git a/samples/19_lowrez_jam_02_buttons/sprites/explosion_0.png b/samples/19_lowrez_jam_02_buttons/sprites/explosion_0.png
deleted file mode 100644
index f48636f..0000000
--- a/samples/19_lowrez_jam_02_buttons/sprites/explosion_0.png
+++ /dev/null
Binary files differ
diff --git a/samples/19_lowrez_jam_02_buttons/sprites/explosion_1.png b/samples/19_lowrez_jam_02_buttons/sprites/explosion_1.png
deleted file mode 100644
index b4018d9..0000000
--- a/samples/19_lowrez_jam_02_buttons/sprites/explosion_1.png
+++ /dev/null
Binary files differ
diff --git a/samples/19_lowrez_jam_02_buttons/sprites/explosion_2.png b/samples/19_lowrez_jam_02_buttons/sprites/explosion_2.png
deleted file mode 100644
index 3abaedd..0000000
--- a/samples/19_lowrez_jam_02_buttons/sprites/explosion_2.png
+++ /dev/null
Binary files differ
diff --git a/samples/19_lowrez_jam_02_buttons/sprites/explosion_3.png b/samples/19_lowrez_jam_02_buttons/sprites/explosion_3.png
deleted file mode 100644
index fe94a5a..0000000
--- a/samples/19_lowrez_jam_02_buttons/sprites/explosion_3.png
+++ /dev/null
Binary files differ
diff --git a/samples/19_lowrez_jam_02_buttons/sprites/explosion_4.png b/samples/19_lowrez_jam_02_buttons/sprites/explosion_4.png
deleted file mode 100644
index ed04237..0000000
--- a/samples/19_lowrez_jam_02_buttons/sprites/explosion_4.png
+++ /dev/null
Binary files differ
diff --git a/samples/19_lowrez_jam_02_buttons/sprites/explosion_5.png b/samples/19_lowrez_jam_02_buttons/sprites/explosion_5.png
deleted file mode 100644
index 2cd8f06..0000000
--- a/samples/19_lowrez_jam_02_buttons/sprites/explosion_5.png
+++ /dev/null
Binary files differ
diff --git a/samples/19_lowrez_jam_02_buttons/sprites/explosion_6.png b/samples/19_lowrez_jam_02_buttons/sprites/explosion_6.png
deleted file mode 100644
index e55909c..0000000
--- a/samples/19_lowrez_jam_02_buttons/sprites/explosion_6.png
+++ /dev/null
Binary files differ
diff --git a/samples/19_lowrez_jam_03_space_shooter/app/main.rb b/samples/19_lowrez_jam_03_space_shooter/app/main.rb
deleted file mode 100644
index e14a9ee..0000000
--- a/samples/19_lowrez_jam_03_space_shooter/app/main.rb
+++ /dev/null
@@ -1,295 +0,0 @@
-=begin
-
- Reminders:
-
- - args.outputs.lines: An array. The values generate a line.
- The parameters are [X1, Y1, X2, Y2, RED, GREEN, BLUE, ALPHA]
- For more information about lines, go to mygame/documentation/04-lines.md.
-
- In this sample app, we're using lines to create the grid lines that make
- a 64x64 grid.
-
- - args.outputs.labels: An array. The values generate a label.
- The parameters are [X, Y, TEXT, SIZE, ALIGNMENT, RED, GREEN, BLUE, ALPHA, FONT STYLE]
- For more information about labels, go to mygame/documentation/02-labels.md.
-
- In this sample app, labels are used to inform the player that they won the game.
-
- - args.outputs.sprites: An array. The values generate a sprite.
- The parameters are [X, Y, WIDTH, HEIGHT, IMAGE PATH, ANGLE, ALPHA, RED, GREEN, BLUE]
- For more information about sprites, go to mygame/documentation/05-sprites.md.
-
- In this sample app, sprites are used to generate ships and bullets.
-
- - args.outputs.solids: An array. The values generate a solid.
- The parameters are [X, Y, WIDTH, HEIGHT, RED, GREEN, BLUE]
- For more information about solids, go to mygame/documentation/03-solids-and-borders.md.
-
- - String interpolation: Uses #{} syntax; everything between the #{ and the } is evaluated
- as Ruby code, and the placeholder is replaced with its corresponding value or result.
-
- - args.state.new_entity: Used when we want to create a new object, like a sprite or button.
- For example, if we want to create a new button, we would declare it as a new entity and
- then define its properties. (Remember, you can use state to define ANY property and it will
- be retained across frames.)
-
- - num1.idiv(num2): Divides two numbers and returns an integer.
-
- - num1.fdiv(num2): Divides two numbers and returns a float (has a decimal).
-
- - Symbol (:): Ruby object with a name and an internal ID. Symbols are useful
- because with a given symbol name, you can refer to the same object throughout
- a Ruby program.
-
- - args.keyboard.key_down.KEY: Determines if a key is in the "down" state or being pressed down.
- For more information about the keyboard, go to mygame/documentation/06-keyboard.md.
-
- - ARRAY#intersect_rect?: Returns true or false depending on if the two rectangles intersect.
- In this sample app, intersects_rect? is being used to determine whether or not a bullet
- hits (or intersects with) the enemy's ship.
-
- - to_i: Returns an integer representation of an object.
-
-=end
-
-# This sample app shows two ships, one for the player and one for the enemy.
-# The goal is to shoot the enemy ship with a bullet.
-
-# https://twitter.com/hashtag/LOWREZJAM
-
-###################################################################################
-# YOUR GAME GOES HERE
-###################################################################################
-
-# Calls methods needed to run the spaceship game properly.
-def lowrez_tick args, lowrez_sprites, lowrez_labels, lowrez_borders, lowrez_solids, lowrez_mouse
- # args.state.show_gridlines = true
-
- if args.state.you_win # if player wins the game
- lowrez_tick_you_win args, lowrez_labels # a label will inform player that they won
- else # otherwise if the game is ongoing
- lowrez_move_bullets args # calls methods needed to run game
- lowrez_move_red_ship args
- lowrez_move_blue_ship args
- lowrez_render_game args, lowrez_sprites
- end
-end
-
-# Informs the player that they won the game using labels
-def lowrez_tick_you_win args, lowrez_labels
- lowrez_labels << [10, 30, "You win!!", 255, 255, 255] # white labels
- lowrez_labels << [4, 24, "Press Enter", 255, 255, 255]
-
- if args.keyboard.key_down.enter # if player presses enter key
- args.state.you_win = false # the player has no longer won (because game resets)
- args.state.bullets.clear # bullets collection is emptied
- args.state.blue_ship_location = nil # ship locations are emptied
- args.state.red_ship_location = nil
- end
-end
-
-# Moves bullets on screen and determines if bullet hit the red (enemy) ship
-def lowrez_move_bullets args
-
- # Initiates an empty bullets collection
- args.state.bullets ||= []
-
- # Changes vertical position of bullets on screen by incrementing their y value
- args.state.bullets.map do |b|
- b.y += 1
- end
-
- # Any bullet with a y value that exceeds screen dimensions is rejected from the collection
- # Vertical dimension is 64 (bullets higher than that have exceeded screen dimensions)
- args.state.bullets = args.state.bullets.reject { |b| b.y >= 64 }
-
- # Checks if any bullets hit the red (enemy) ship
- bullets_hit_red_ship = args.state.bullets.any? do |b|
- b_rect = [b.x, b.y, 1, 1] # sets bullet definition
- ship_rect = [args.state.red_ship_location.x, args.state.red_ship_location.y, 5, 5] # sets enemy definition
- b_rect.intersect_rect? ship_rect # checks for intersections between bullet and red enemy ship
- end
-
- if bullets_hit_red_ship == true # if bullet hits red enemy ship
- args.state.you_win = true # the player wins
- end
-end
-
-# Moves the red (enemy) ship on the screen
-def lowrez_move_red_ship args
-
- # Initializes the red ship's position on the screen
- args.state.red_ship_location ||= [31, 58]
-
- # Moves the ship by changing its x value.
- if args.state.red_ship_location.x.to_i <= 1 # if ship moves too far left
- args.state.red_ship_location.x += 1 # moves right
- elsif args.state.red_ship_location.x.to_i >= 62 # if ship moves too far right
- args.state.red_ship_location.x -= 1 # moves left
- else # otherwise, if ship is within screen horizontal dimensions
- args.state.red_ship_location.x += rand * 1.randomize(:sign) # randomize x increment
- end
-end
-
-# Moves the blue ship on the screen
-def lowrez_move_blue_ship args
-
- # Initializes the blue ship's position on the screen
- args.state.blue_ship_location ||= [0, 0]
-
- # Uses keyboard input from the player to move the blue ship.
- if args.keyboard.right # if right key is pressed
- args.state.blue_ship_location.x += 0.5 # increment x to move right
- elsif args.keyboard.left # if left key is pressed
- args.state.blue_ship_location.x -= 0.5 # decrement x to move left
- end
-
- # Shoots out bullets when the player presses the space bar
- if args.keyboard.key_down.space # if space bar is pressed
- args.state.bullets << [args.state.blue_ship_location.x + 2,
- args.state.blue_ship_location.y + 3] # bullet is given location on screen
- end
-end
-
-# Sets the definition of the ships and bullets.
-def lowrez_render_game args, lowrez_sprites
- lowrez_sprites << [args.state.blue_ship_location.x,
- args.state.blue_ship_location.y,
- 5,
- 5,
- 'sprites/ship_blue.png'] # definition of player ship sprite
-
- lowrez_sprites << args.state.bullets.map do |b| # add to bullets collection
- [b.x, b.y, 1, 1, 'sprites/blue_bullet.png'] # definition of bullet
- end
-
- lowrez_sprites << [args.state.red_ship_location.x,
- args.state.red_ship_location.y,
- 5,
- 5,
- 'sprites/ship_red.png',
- 180] # definition of enemy ship sprite
-end
-
-###################################################################################
-# YOU CAN PLAY AROUND WITH THE CODE BELOW, BUT USE CAUTION AS THIS IS WHAT EMULATES
-# THE 64x64 CANVAS.
-###################################################################################
-
-# Sets values to produce 64x64 canvas.
-# These values are not changed, which is why ||= is not used.
-TINY_RESOLUTION = 64
-TINY_SCALE = 720.fdiv(TINY_RESOLUTION) # original dimension of 720 is scaled down by 64
-CENTER_OFFSET = (1280 - 720).fdiv(2) # sets center
-EMULATED_FONT_SIZE = 20
-EMULATED_FONT_X_ZERO = 0 # increasing this value would shift labels to the right
-EMULATED_FONT_Y_ZERO = 46 # increasing shifts labels up, decreasing shifts labels down
-
-# Creates empty collections, and calls methods needed for the game to run properly.
-def tick args
- sprites = []
- labels = []
- borders = []
- solids = []
- mouse = emulate_lowrez_mouse args # calls method to set mouse to mouse's position
- args.state.show_gridlines = false # do not show grid lines
- lowrez_tick args, sprites, labels, borders, solids, mouse # contains definitions of objects
- render_gridlines_if_needed args # output grid lines if show_gridlines is true
- render_mouse_crosshairs args, mouse # outputs position of mouse using label
- emulate_lowrez_scene args, sprites, labels, borders, solids, mouse # emulates scene on screen
-end
-
-# Sets values based on the position of the mouse on the screen.
-def emulate_lowrez_mouse args
-
- # Declares the mouse as a new entity and sets values for the x and y variables.
- args.state.new_entity_strict(:lowrez_mouse) do |m|
- # mouse's original coordinates are scaled down to match canvas
- # original coordinates were within 1280x720 dimensions
- m.x = args.mouse.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1
- m.y = args.mouse.y.idiv(TINY_SCALE)
-
- if args.mouse.click # if mouse is clicked
- m.click = [ # sets definition and stores mouse click's definition (coordinates)
- args.mouse.click.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1,
- args.mouse.click.point.y.idiv(TINY_SCALE)
- ]
- m.down = m.click # down stores click's value, which is mouse click's position
- else
- m.click = nil # if no click occurred, both click and down are empty (do not store any position)
- m.down = nil
- end
-
- if args.mouse.up # if mouse is up (not pressed or held down)
- m.up = [ # sets definition, stores mouse's position
- args.mouse.up.point.x.idiv(TINY_SCALE) - CENTER_OFFSET.idiv(TINY_SCALE) - 1,
- args.mouse.up.point.y.idiv(TINY_SCALE)
- ]
- else
- m.up = nil # if mouse is not in "up" state, up is empty (has no value)
- end
- end
-end
-
-# Outputs the position of the mouse on the screen using a white label
-def render_mouse_crosshairs args, mouse
- return unless args.state.show_gridlines # return unless true (grid lines are showing)
- args.labels << [10, 25, "mouse: #{mouse.x} #{mouse.y}", 255, 255, 255] # string interpolation
-end
-
-# Emulates the low rez scene by adding solids, sprites, etc. to the appropriate collections and creating labels
-def emulate_lowrez_scene args, sprites, labels, borders, solids, mouse
- args.render_target(:lowrez).sprites << sprites # outputs sprites on screen
-
- # The font that is used is saved in the game's folder.
- # Without the .ttf file, the label would not be created correctly.
- args.outputs.labels << labels.map do |l| # outputs all elements of labels collection
- as_label = l.label
- l.text.each_char.each_with_index.map do |char, i| # perform action on each character in labels collection
- # label definition
- # places space between characters
- # centered to fit within grid dimensions
- [CENTER_OFFSET + EMULATED_FONT_X_ZERO + (as_label.x * TINY_SCALE) + i * 5 * TINY_SCALE,
- EMULATED_FONT_Y_ZERO + (as_label.y * TINY_SCALE), char,
- EMULATED_FONT_SIZE, 0, as_label.r, as_label.g, as_label.b, as_label.a, 'dragonruby-gtk-4x4.ttf']
- end
- end
-
- args.render_target(:lowrez).solids << [0, 0, 1280, 720] # black background
- args.sprites << [CENTER_OFFSET, 0, 1280 * TINY_SCALE, 720 * TINY_SCALE, :lowrez] # sprites and background of grid
- args.primitives << [0, 0, CENTER_OFFSET, 720].solid # black background on left side of grid
- args.primitives << [1280 - CENTER_OFFSET, 0, CENTER_OFFSET, 720].solid # black on right side of grid
- args.primitives << [0, 0, 1280, 2].solid # black on bottom; change 2 to 200 and see what happens
-end
-
-def render_gridlines_if_needed args
- # if grid lines are showing and static_lines collection (which contains grid lines) is empty
- if args.state.show_gridlines && args.static_lines.length == 0
- # add to the collection by adding line definitions 65 times (because of 64x64 canvas)
- # placed at equal distance apart within grid dimensions
- args.static_lines << 65.times.map do |i|
- [
- # [starting x, starting y, ending x, ending y, red, green, blue]
- # Vertical lines have the same starting and ending x value.
- # To make the vertical grid lines look thicker and more prominent, two separators are
- # placed together one pixel apart (explains "+1" in x parameter) as one vertical grid line.
- [CENTER_OFFSET + i * TINY_SCALE + 1, 0,
- CENTER_OFFSET + i * TINY_SCALE + 1, 720, 128, 128, 128], # vertical line 1
- [CENTER_OFFSET + i * TINY_SCALE, 0,
- CENTER_OFFSET + i * TINY_SCALE, 720, 128, 128, 128], # vertical line 2
- # Horizontal lines have the same starting and ending y value.
- # The two horizontal separators that are considered one grid line are placed
- # one pixel apart (explains the "1 +" in the y parameter).
- # That is why there are four line definitions (distinguished by []) being added to static_lines.
- # Two vertical and two horizontal separators are added to create one vertical
- # and one horizontal grid line.
- [CENTER_OFFSET, 0 + i * TINY_SCALE,
- CENTER_OFFSET + 720, 0 + i * TINY_SCALE, 128, 128, 128], # horizontal line 1
- [CENTER_OFFSET, 1 + i * TINY_SCALE,
- CENTER_OFFSET + 720, 1 + i * TINY_SCALE, 128, 128, 128] # horizontal line 2
- ]
- end
- elsif !args.state.show_gridlines # if show_gridlines is false (grid lines are not showing)
- args.static_lines.clear # clear the collection so no grid lines are in it
- end
-end
diff --git a/samples/19_lowrez_jam_03_space_shooter/dragonruby-gtk-4x4.ttf b/samples/19_lowrez_jam_03_space_shooter/dragonruby-gtk-4x4.ttf
deleted file mode 100644
index 24cc711..0000000
--- a/samples/19_lowrez_jam_03_space_shooter/dragonruby-gtk-4x4.ttf
+++ /dev/null
Binary files differ
diff --git a/samples/19_lowrez_jam_03_space_shooter/license-for-sample.txt b/samples/19_lowrez_jam_03_space_shooter/license-for-sample.txt
deleted file mode 100644
index 100dcec..0000000
--- a/samples/19_lowrez_jam_03_space_shooter/license-for-sample.txt
+++ /dev/null
@@ -1,9 +0,0 @@
-Copyright 2019 DragonRuby LLC
-
-MIT License
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/samples/19_lowrez_jam_03_space_shooter/replay.txt b/samples/19_lowrez_jam_03_space_shooter/replay.txt
deleted file mode 100644
index 37509b9..0000000
--- a/samples/19_lowrez_jam_03_space_shooter/replay.txt
+++ /dev/null
@@ -1,147 +0,0 @@
-replay_version 2.0
-stopped_at 946
-seed 100
-recorded_at Sun Sep 29 22:37:57 2019
-[:key_down_raw, 1073741903, 0, 2, 1, 101]
-[:key_down_raw, 1073741903, 0, 2, 2, 126]
-[:key_down_raw, 1073741903, 0, 2, 3, 128]
-[:key_down_raw, 1073741903, 0, 2, 4, 130]
-[:key_down_raw, 1073741903, 0, 2, 5, 132]
-[:key_down_raw, 1073741903, 0, 2, 6, 134]
-[:key_down_raw, 1073741903, 0, 2, 7, 136]
-[:key_down_raw, 1073741903, 0, 2, 8, 138]
-[:key_down_raw, 32, 0, 2, 9, 140]
-[:key_up_raw, 32, 0, 2, 10, 146]
-[:key_down_raw, 32, 0, 2, 11, 151]
-[:key_up_raw, 32, 0, 2, 12, 155]
-[:key_down_raw, 32, 0, 2, 13, 160]
-[:key_up_raw, 32, 0, 2, 14, 164]
-[:key_down_raw, 32, 0, 2, 15, 169]
-[:key_up_raw, 32, 0, 2, 16, 173]
-[:key_up_raw, 1073741903, 0, 2, 17, 173]
-[:key_down_raw, 32, 0, 2, 18, 176]
-[:key_down_raw, 1073741904, 0, 2, 19, 179]
-[:key_up_raw, 32, 0, 2, 20, 181]
-[:key_down_raw, 32, 0, 2, 21, 186]
-[:key_up_raw, 32, 0, 2, 22, 191]
-[:key_down_raw, 32, 0, 2, 23, 196]
-[:key_down_raw, 1073741903, 0, 2, 24, 196]
-[:key_up_raw, 1073741904, 0, 2, 25, 197]
-[:key_up_raw, 32, 0, 2, 26, 201]
-[:key_down_raw, 32, 0, 2, 27, 206]
-[:key_up_raw, 32, 0, 2, 28, 210]
-[:key_down_raw, 32, 0, 2, 29, 216]
-[:key_up_raw, 32, 0, 2, 30, 227]
-[:key_up_raw, 1073741903, 0, 2, 31, 232]
-[:key_down_raw, 1073741903, 0, 2, 32, 255]
-[:key_down_raw, 32, 0, 2, 33, 267]
-[:key_up_raw, 1073741903, 0, 2, 34, 268]
-[:key_up_raw, 32, 0, 2, 35, 274]
-[:key_down_raw, 1073741904, 0, 2, 36, 277]
-[:key_down_raw, 32, 0, 2, 37, 284]
-[:key_up_raw, 32, 0, 2, 38, 290]
-[:key_up_raw, 1073741904, 0, 2, 39, 293]
-[:key_down_raw, 1073741904, 0, 2, 40, 301]
-[:key_down_raw, 32, 0, 2, 41, 309]
-[:key_up_raw, 32, 0, 2, 42, 315]
-[:key_up_raw, 1073741904, 0, 2, 43, 319]
-[:key_down_raw, 32, 0, 2, 44, 319]
-[:key_up_raw, 32, 0, 2, 45, 325]
-[:key_down_raw, 1073741903, 0, 2, 46, 325]
-[:key_down_raw, 32, 0, 2, 47, 328]
-[:key_up_raw, 1073741903, 0, 2, 48, 334]
-[:key_up_raw, 32, 0, 2, 49, 334]
-[:key_down_raw, 32, 0, 2, 50, 338]
-[:key_down_raw, 1073741903, 0, 2, 51, 343]
-[:key_up_raw, 32, 0, 2, 52, 344]
-[:key_down_raw, 32, 0, 2, 53, 348]
-[:key_up_raw, 1073741903, 0, 2, 54, 355]
-[:key_up_raw, 32, 0, 2, 55, 355]
-[:key_down_raw, 32, 0, 2, 56, 430]
-[:key_up_raw, 32, 0, 2, 57, 435]
-[:key_down_raw, 32, 0, 2, 58, 441]
-[:key_up_raw, 32, 0, 2, 59, 445]
-[:key_down_raw, 1073741904, 0, 2, 60, 449]
-[:key_down_raw, 32, 0, 2, 61, 449]
-[:key_up_raw, 32, 0, 2, 62, 454]
-[:key_down_raw, 32, 0, 2, 63, 458]
-[:key_up_raw, 1073741904, 0, 2, 64, 464]
-[:key_up_raw, 32, 0, 2, 65, 464]
-[:key_down_raw, 32, 0, 2, 66, 467]
-[:key_down_raw, 1073741903, 0, 2, 67, 470]
-[:key_up_raw, 32, 0, 2, 68, 473]
-[:key_down_raw, 32, 0, 2, 69, 478]
-[:key_up_raw, 1073741903, 0, 2, 70, 482]
-[:key_up_raw, 32, 0, 2, 71, 483]
-[:key_down_raw, 32, 0, 2, 72, 488]
-[:key_up_raw, 32, 0, 2, 73, 490]
-[:mouse_move, 1279, 522, 2, 74, 551]
-[:mouse_move, 1183, 522, 2, 75, 552]
-[:mouse_move, 1044, 522, 2, 76, 553]
-[:mouse_move, 906, 518, 2, 77, 554]
-[:mouse_move, 865, 516, 2, 78, 555]
-[:mouse_move, 704, 515, 2, 79, 556]
-[:mouse_move, 632, 513, 2, 80, 557]
-[:mouse_move, 502, 512, 2, 81, 558]
-[:mouse_move, 477, 512, 2, 82, 559]
-[:mouse_move, 413, 512, 2, 83, 560]
-[:mouse_move, 401, 512, 2, 84, 561]
-[:mouse_move, 372, 512, 2, 85, 562]
-[:mouse_move, 345, 512, 2, 86, 563]
-[:mouse_move, 323, 514, 2, 87, 564]
-[:mouse_move, 315, 516, 2, 88, 565]
-[:mouse_move, 297, 520, 2, 89, 566]
-[:mouse_move, 288, 522, 2, 90, 567]
-[:mouse_move, 279, 524, 2, 91, 568]
-[:mouse_move, 272, 526, 2, 92, 569]
-[:mouse_move, 265, 528, 2, 93, 570]
-[:mouse_move, 263, 528, 2, 94, 571]
-[:mouse_move, 261, 528, 2, 95, 572]
-[:mouse_move, 269, 528, 2, 96, 574]
-[:mouse_move, 271, 528, 2, 97, 575]
-[:mouse_move, 276, 527, 2, 98, 576]
-[:mouse_move, 278, 527, 2, 99, 577]
-[:mouse_move, 280, 526, 2, 100, 578]
-[:mouse_move, 282, 525, 2, 101, 579]
-[:mouse_move, 286, 523, 2, 102, 580]
-[:mouse_move, 288, 522, 2, 103, 581]
-[:mouse_move, 292, 520, 2, 104, 582]
-[:mouse_move, 299, 517, 2, 105, 583]
-[:mouse_move, 302, 516, 2, 106, 584]
-[:mouse_move, 310, 512, 2, 107, 585]
-[:mouse_move, 313, 510, 2, 108, 586]
-[:mouse_move, 325, 503, 2, 109, 587]
-[:mouse_move, 332, 500, 2, 110, 588]
-[:mouse_move, 349, 492, 2, 111, 589]
-[:mouse_move, 358, 490, 2, 112, 590]
-[:mouse_move, 379, 486, 2, 113, 591]
-[:mouse_move, 384, 486, 2, 114, 592]
-[:mouse_move, 402, 485, 2, 115, 593]
-[:mouse_move, 418, 485, 2, 116, 594]
-[:mouse_move, 439, 485, 2, 117, 595]
-[:mouse_move, 451, 485, 2, 118, 596]
-[:mouse_move, 474, 486, 2, 119, 597]
-[:mouse_move, 486, 486, 2, 120, 598]
-[:mouse_move, 511, 486, 2, 121, 599]
-[:mouse_move, 525, 486, 2, 122, 600]
-[:mouse_move, 555, 483, 2, 123, 601]
-[:mouse_move, 571, 481, 2, 124, 602]
-[:mouse_move, 606, 477, 2, 125, 603]
-[:mouse_move, 623, 475, 2, 126, 604]
-[:mouse_move, 656, 473, 2, 127, 605]
-[:mouse_move, 685, 471, 2, 128, 606]
-[:mouse_move, 711, 469, 2, 129, 607]
-[:mouse_move, 728, 469, 2, 130, 608]
-[:mouse_move, 752, 468, 2, 131, 609]
-[:mouse_move, 764, 467, 2, 132, 610]
-[:mouse_move, 767, 467, 2, 133, 611]
-[:mouse_move, 780, 467, 2, 134, 612]
-[:mouse_move, 784, 467, 2, 135, 613]
-[:mouse_move, 787, 467, 2, 136, 614]
-[:mouse_move, 788, 467, 2, 137, 615]
-[:mouse_move, 789, 468, 2, 138, 616]
-[:mouse_move, 790, 468, 2, 139, 625]
-[:key_down_raw, 13, 0, 2, 140, 653]
-[:key_up_raw, 13, 0, 2, 141, 657]
-[:key_down_raw, 1073742051, 1024, 2, 142, 871]
-[:key_down_raw, 113, 1024, 2, 143, 945]
diff --git a/samples/19_lowrez_jam_03_space_shooter/sprites/blue_bullet.png b/samples/19_lowrez_jam_03_space_shooter/sprites/blue_bullet.png
deleted file mode 100644
index 78ae7d0..0000000
--- a/samples/19_lowrez_jam_03_space_shooter/sprites/blue_bullet.png
+++ /dev/null
Binary files differ